Write a function remove_duplicates(arr) that removes duplicate elements from an array while maintaining the original order of first appearances.
Example:
Input: arr = [1, 2, 2, 3, 4, 4, 5]
Output: [1, 2, 3, 4, 5]
Constraints:
Test Cases
Test Case 1
Input:
[1, 2, 2, 3, 4, 4, 5]Expected:
[1, 2, 3, 4, 5]Test Case 2
Input:
[5, 5, 5, 5]Expected:
[5]Test Case 3
Input:
[1, 2, 3]Expected:
[1, 2, 3]+ 2 hidden test cases