How do you write a function that removes duplicated elements in an array?
Implement remove_duplicates(arr) to return a new array containing each value once, preserving the order of its first occurrence. The input is an array of integers, and the original array must not be modified.
Input: arr, an array of integers. Output: a new array with duplicates removed.
def remove_duplicates(arr):