Find All Duplicates
Practice this coding question on Coding Gurukul.
Problem statement
A scanner records n badge numbers in the range 1 through n. Each number appears once or twice. Identify every number that appears twice. Return them in increasing order so the audit report is deterministic; print NONE when there are no duplicates.
Input format
First line: n. Second line: n space-separated integers.
Output format
Print duplicate values in increasing order, or NONE.
Constraints
1 <= n <= 100000; 1 <= value <= n; each value appears at most twice.
Sample input
6 1 4 3 4 5 3
Sample output
3 4
Sign in to run or submit a solution in C++, Java or Python.