Search⌘ K
AI Features

Problem: Contains Duplicate

Explore how to determine if an integer array contains duplicates by using a hash set for constant-time lookups. Learn to implement this efficient O(n) time and O(n) space solution in JavaScript, focusing on real-world problem solving with hash tables.

Statement

Given an integer array nums, determine whether any value appears more than once in the array. Return TRUE if a duplicate exists, and FALSE if all elements are unique.

Constraints:

  • 11 \leq nums.length 105\leq 10^5

  • ...