Given a list nums of integers, return a new list containing only the unique elements from nums in the order of their first appearance. The input is a Python list, and the output must also be a Python list.
Constraints
0 <= len(nums) <= 10^5
-10^9 <= nums[i] <= 10^9
Preserve the order of first occurrence in the result
Function Signature
defunique_elements(nums):
Interviewer
Your question is Unique Elements from a List. Start with the requirements in the Question tab.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.