Contains a duplicate
Easyarrayhash set
Return true if any value appears more than once in nums, and false if every value is distinct.
Example 1
Input: nums = [1,2,3,1] Output: true
Example 2
Input: nums = [1,2,3,4] Output: false
Constraints
- 0 ≤ nums.length ≤ 10⁵
- -10⁹ ≤ nums[i] ≤ 10⁹
Submit checks your solution against 8 tests, including hidden ones.
/**
* @param {int[]} nums
* @return {bool}
*/
function hasDuplicate(nums) {
}