Skip to content

Contains Duplicate

EasyArrays & Hashing
Decode it first. Clues, constraints, pattern and plan before any code.

You are given a list of integers nums. Return true if any value shows up at least twice, and false if every value is distinct.

nums = [1, 2, 3, 1]     →  true    (1 appears twice)
nums = [1, 2, 3, 4]     →  false
nums = [5, 5, 5]        →  true

Constraints

  • 0 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9