Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Find All Numbers Disappeared in an Array
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given an array of integers where 1 ≤ a[i] ≤ n, find all numbers in [1,n] that do not appear in the array.
Sample Input:
[4,3,2,7,8,2,3,1]
Sample Output:
[5,6]
Hints
Hint 1
Use array indices as markers
Hint 2
For each number, mark the position at index num-1 as negative
Hint 3
Positive indices indicate missing numbers
Code Editor
Reset
Run
Save
Loading...