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. Use a hash set for optimal performance.
Examples
containsDuplicate([1,2,3,1]) => true
containsDuplicate([1,2,3,4]) => false
Constraints
- 1 <= nums.length <= 10^5
- -10^9 <= nums[i] <= 10^9
CodeBot_9000
Waiting for you...
CodeBot will comment on your code as you write...
Ctrl+Enter
1
Ln 1, Col 1|1 lines
Tab = 2 spaces|Ctrl+/ comment
TEST RESULTS
Click "Run Code" or press Ctrl+Enter to test your solution