I have been asked this question in a job interview and I have been wondering about the right answer.
You have an array of numbers from 0 to n-1, one o
Use a HashSet to hold all numbers already seen. It operates in (amortized) O(1) time, so the total is O(N).
HashSet
O(1)
O(N)