Build the PrimitiveEasy
Contains Duplicate
Write `has_duplicate(nums)` that returns `True` when any value appears more than once in the list, and `False` when every value is distinct.
has_duplicate([1, 2, 3, 1]) -> True
has_duplicate([1, 2, 3, 4]) -> False
Sorting first works and costs O(n log n). The point of this one is the trade you make instead: spend memory to buy time, and return the moment you have your answer rather than finishing the scan.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.