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 list, and the output must also be a 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
Whenever you're ready, walk me through your approach or go straight to the code. The requirements are in the Question tab.