Return true if any value appears at least twice.
Set membership. If insert fails / already exists → duplicate.
Sorting also works (O(n log n)) but the set is the interview answer.
Input
4 1 2 3 1
Output
true
4 1 2 3 4
false