Given a list of integers nums, return True if some value appears at least twice, and False if every value is different.
The starter code is correct, but it compares every pair of values, which is too slow for long lists. Make it fast.
Example 1
Input:
has_duplicate([1, 2, 3, 1])
Output:
True
Example 2
Input:
has_duplicate([1, 2, 3, 4])
Output:
False
1 <= len(nums) <= 2 * 10**5-10**9 <= nums[i] <= 10**9No results yet
Run your code to check it against the examples, or submit to run every test.