easy
Contains Duplicate
Return true if any integer occurs more than once in nums; otherwise return false.
Constraints
- 1 ≤ n ≤ 100000
- -10^9 ≤ nums[i] ≤ 10^9
Examples
in: [[2,9,2]]
out: true
Repeated value
in: [[4,1,8]]
out: false
Unique
Code it yourself
Solve in
Practice journal →Draft saved in this browser.
Public test cases · contract v1
Arguments are passed to your function. Tests are public practice checks, not hidden interview grading. Passing does not prove every possible input.
- Repeated value
[[2,9,2]] → true
- Unique
[[4,1,8]] → false
- Single
[[0]] → false
- Negative duplicate
[[-3,0,-3]] → true
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.