Easy

Quiz

#448 Find All Numbers Disappeared in an Array

APPROACH

Given an array nums of n integers where every value lies in the range [1, n], some values may appear twice while others are missing. Return a list of every integer in [1, n] that does not appear in nums.

Example 1:

Input: nums = [4,3,2,7,8,2,3,1]
Output: [5,6]

Example 2:

Input: nums = [1,1]
Output: [2]
1 of 4
1:00

What is the optimal approach for this problem?