Given an array of integers nums, return an array of all elements that appear more than once. The result can be in any order, and each duplicate value should only appear once in the output.
For example, given [4, 3, 2, 7, 8, 2, 3, 1], the duplicates are [2, 3] (in any order).
nums = [4, 3, 2, 7, 8, 2, 3, 1][2, 3]nums = [1, 1, 1][1]nums = [1, 2, 3][]0 <= nums.length <= 10^4-10^9 <= nums[i] <= 10^9Output should contain each duplicate value exactly once.Run your code to see results
Use Cmd+Enter to run