nums holds n whole numbers, each between 1 and n. Some values may appear more than once, which means others don't appear at all. Return every value in the range 1 to n that is missing from nums. You may return them in any order.
Aim for O(n) time and no extra memory beyond the list you return.
With n = 6 the values should be 1 to 6. 1 and 5 each appear twice, which leaves no room for 3 and 4.
Every value from 1 to 3 is there, so nothing is missing.
Constraints
n == nums.length1 <= n <= 10⁵1 <= nums[i] <= nEvery value is between 1 and n, and the array has n slots. So each value can point at a slot of the array itself: value v belongs to index v − 1.