input: Write a python function to rotate an array by k positions.
  assert rotate_array([1,2,3,4,5],2) == [4,5,1,2,3]
  assert rotate_array([1,2,3,4,5],3) == [3,4,5,1,2]
  assert rotate_array([1,2,3,4,5],1) == [5,1,2,3,4]
output: def rotate_array(arr, k):
      n = len(arr)
      k = k % n  # handle cases where k > n
      return arr[-k:] + arr[:-k]