Implement a function that removes duplicates from a list while preserving the order of first occurrences. Examples:
- Input:
[1, 2, 2, 3, 1, 4]→ Output:[1, 2, 3, 4] - Input:
[5, 5, 5, 5]→ Output:[5] - Input:
[1, 2, 3]→ Output:[1, 2, 3] - Input:
[]→ Output:[]
Constraints:
- Return a new list (don't modify the input)
- Preserve order of first occurrences
- Handle empty lists
Write remove_duplicates(nums) that returns the deduplicated list.