Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Example 1
Input: nums = [1,2,3,1]
Output: true
Explanation: The value 1 appears at index 0 and again at index 3, so the array contains a duplicate.
Example 2
Input: nums = [1,2,3,4]
Output: false
Explanation: All four values are different, so there is no duplicate.
Example 3
Input: nums = [1,1,1,3,3,4,3,2,4,2]
Output: true
Explanation: Several values repeat (1 appears three times, for example), so the answer is true.
Track values we have already seen in a hash set. The first time a number is already present, we have found a duplicate.
Run checks all cases above. Submit evaluates all test cases.