Find All Duplicates in an Array
Try to solve the Find All Duplicates in an Array problem.
We'll cover the following
Statement
Given an integer array, nums
, of length , where all the integers of nums
are in the range and each integer appears once or twice, return an array of all the integers that appear twice.
Note: Write an algorithm that runs in time and uses only constant auxiliary space, excluding the space occupied by the output.
Constraints:
-
nums.length
-
-
nums[i]
-
Each element in
nums
appears once or twice.
Examples
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.