Ctrl K

No Two Counts Alike

Easy
You get an integer array values. For every distinct value, count how many times it occurs. Return True if all these counts are pairwise different, and False if at least two values occur the same number of times.
Example 1
values=[4, 7, 7, 4, 4, 9] → True

4 occurs 3 times, 7 twice, 9 once. All counts differ.

Example 2
values=[1, 2, 2, 1] → False

Both 1 and 2 occur twice.

Constraints
  • 1 ≤ len(values) ≤ 1000
  • -1000 ≤ values[i] ≤ 1000
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsPair With a Target Sum EasyThe Candidate With Most Votes EasyDoes Any Value Repeat EasyRepeat Within Reach EasyThe Lost Ticket Easy
loading Python…
Input
values=[4, 7, 7, 4, 4, 9]
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 109 tests on the server, hidden ones included.