input: Write a function that optimizes the given Python code to use built-in functions. The original function removes duplicates from an array using nested loops. The optimized function should achieve the same result but more efficiently.
  assert removeDuplicates([1, 2, 2, 3, 4, 4, 5]) == [1, 2, 3, 4, 5]
  assert removeDuplicates([10, 20, 30, 20, 10, 40, 50]) == [10, 20, 30, 40, 50]
  assert removeDuplicates([]) == []
  assert removeDuplicates([7, 7, 7, 7]) == [7]
output: def removeDuplicates(arr):
      return list(dict.fromkeys(arr))