Find All Numbers Disappeared in an Array
EasyArrays & Hashing
Decode it first. Clues, constraints, pattern and plan before any code.You are given a list nums of n integers where each value is in the range 1 to n. Some values appear twice and others are missing. Return every value from 1 to n that does not appear, in increasing order. As a follow-up, try it with no extra space besides the returned list.
nums = [4, 3, 2, 7, 8, 2, 3, 1] → [5, 6]
nums = [1, 1] → [2]
nums = [1, 2, 3, 4] → []Constraints
n == nums.length1 <= n <= 10^51 <= nums[i] <= n