Contains Duplicate (Set 3)

Easy

Given an array of integers nums, return true when at least two values are equal, and false when every value is distinct.

Contains Duplicate (Set 3) — the data. This set runs 4 cases: nums holds arrays of 14–28 items, with values from -26 to 25. The hidden cases are the largest of the set.

Example 1

containsDuplicate()
Input
nums = [2, 3, 2, 1, 5, 2, 1, 1, 3, 6, 6, 6, 5, 2, 2, 1, 1, 3, 4, 6, 3, 1]
Output
true

Why

`containsDuplicate` returns `true` for this input.

Example 2

containsDuplicate()
Input
nums = [2, 2, 5, 1, 5, 5, 1, 6, 5, 4, 6, 5, 5, 6]
Output
true

Why

`containsDuplicate` returns `true` for this input.
Constraints
0 <= nums.length <= 10^5
-10^4 <= nums[i] <= 10^4
Every case in this set must pass: the first two are visible on Run, the last two unlock on Submit.

Topics

ArraysHash Table

Implement containsDuplicate in the editor and return the answer — printing it is never graded.