Back to Question

Find All Duplicates in an Array

Question Explain

Given an array of integers, where $1 \leq a[i] \leq n$, some elements appear twice and others appear once. Find all the elements that appear twice. Solve without extra space and in $O(n)$ runtime.

Start Trying This Question Simulation

Click "Start Speaking" and answer the question naturally.