Skip to content
Decoder

Unique Number of Occurrences

Easy

Problem

Given a list of integers arr, return true if **no two different values appear the same number of times**, in other words if every value's count is unique. Otherwise return false.

Example 1

Input
arr = [1, 2, 2, 1, 1, 3]
Output
true
Why
1 three times, 2 twice, 3 once

Example 2

Input
arr = [1, 2]
Output
false
Why
both appear once

Constraints

  • 1 <= arr.length <= 1000
  • -1000 <= arr[i] <= 1000

Read it once before you touch anything

Want some pressure? Start the timer. In an interview you get about two minutes to understand the problem.

  1. 1Read the goalWhat goes in, what comes out
  2. 2Scan the examplesCheck one by hand
  3. 3Note the constraintsThey set your Big O
Say what it asks in one sentence
Say it out loud first, then compare with ours.