Search
⌘K
Get Premium
Leetcode 442. Find All Duplicates in an Array
Given an array of length n with values in [1,n] where each value appears once or twice, return all values that appear twice in O(n) time and O(1) extra space. The core challenge is to detect duplicates by using the input array itself as bookkeeping (mapping values to indices) rather than extra data structures.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.