
Given an integer array nums, return all values that appear more than once. Each duplicate should appear only once in the output, in the order it is first detected as a repeat during a left-to-right scan.
nums = [1, 2, 3, 2, 4, 1]Output[2, 1]Why`2` is the first repeated value, then `1`.nums = [5, 5, 5, 5]Output[5]WhyReturn each duplicated value only once.`1 <= len(nums) <= 10^5``-10^9 <= nums[i] <= 10^9`Each duplicate value should appear at most once in the result