Missing Numbers
ARRAY

Problem

Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.

Examples

findDisappearedNumbers([3,4,5,2,8,2,3,1]) // returns [6,7] // 6 and 7 are the numbers in the // range 1 to 8 that are not in the array. findDisappearedNumbers([2,2]) // returns [1] // 1 is the number in the // range 1 to 2 that is not in the array.
Loading...