Problem
You get an integer array arr. Count the number of times that each value appears in arr.
Return true if each value has a different count. Return false otherwise.
Example 1
- Input:
- arr = [5,5,5,2,9,9]
- Output:
- true
- Explanation:
- The value 5 appears 3 times, 9 appears 2 times, and 2 appears 1 time. All the counts are different.
Example 2
- Input:
- arr = [4,8,4,8]
- Output:
- false
- Explanation:
- The values 4 and 8 both appear 2 times.
Example 3
- Input:
- arr = [-2,0,0,-2,-2,6]
- Output:
- true
Constraints
- 1 <= arr.length <= 1000
- -1000 <= arr[i] <= 1000
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Check if All Characters Have Equal Number of Occurrences
Coding
- First Unique Number
Coding · Array · Data Stream · Design
- Largest Unique Number
Coding
- Least Number of Unique Integers after K Removals
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1207. Unique Number of Occurrences
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source