Find Disappeared Numbers
nums has n items and every item is between 1 and n. Some numbers in that range never appear in nums.
Return those missing numbers in increasing order.
Example 1
nums [4,3,2,7,8,2,3,1]
returns [5,6]
5 and 6 never appear.
Example 2
nums [1,1]
returns [2]
n = 2 and 2 is missing.
Constraints
1 <= len(nums) <= 501 <= nums[i] <= len(nums)
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Arrays problems
- Find Pivot IndexEasy
- First PeakEasy
- Largest DrawdownEasy
- Left Steps to MatchEasy
- Missing RangesEasy
- Monotonic ArrayEasy
- Nearest Aligned PointEasy
- Outside InEasy