input: Write a python function to sort a 2D array based on the second element of each sub-array.
  assert sortArray([[1, 2],[2, 6], [3, 4], [4, 5]]) == [[1, 2], [3, 4], [4, 5], [2, 6]]
  assert sortArray([[2, 3], [1, 2], [4, 1]]) == [[4, 1], [1, 2], [2, 3]]
  assert sortArray([[10, 20], [5, 10], [1, 5]]) == [[1, 5], [5, 10], [10, 20]]
output: def sortArray(arr):
      return sorted(arr, key=lambda x: x[1])