Problem
You get an array of integers nums. Return true if a value appears two or more times in nums. Return false if all the values are different.
Example 1
- Input:
- nums = [7,3,9,3]
- Output:
- true
- Explanation:
- The value 3 appears at index 1 and at index 3.
Example 2
- Input:
- nums = [5,8,2,6]
- Output:
- false
- Explanation:
- All four values are different.
Example 3
- Input:
- nums = [-4,0,-4,0,11]
- Output:
- true
Constraints
- 1 <= nums.length <= 10^5
- -10^9 <= nums[i] <= 10^9
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Accounts Merge
Coding · Array · Breadth-First Search · Depth-First Search
- Analyze User Website Visit Pattern
Coding · Array · Hash Table · Sorting
- Group Anagrams
Coding · Array · Hash Table · Sorting
- High Five
Coding · Array · Hash Table · Heap (Priority Queue)
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Google
Leetcode 217. Contains Duplicate
Reported Oct 10, 2024 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 4 records
Google
Contains Duplicate
Reported date not specified · Source window: 3mo
Source snapshot: Oct 20, 2026
Source frequency score: 58.4. This is not an interview probability.
View sourceGoogle
Contains Duplicate
Reported date not specified · Source window: 6mo
Source snapshot: Oct 20, 2026
Source frequency score: 57.1. This is not an interview probability.
View sourceMeta
Contains Duplicate
Reported date not specified · Source window: 3mo