Skip to content

Unique Number of Occurrences

EasyArrays & Hashing
Decode it first. Clues, constraints, pattern and plan before any code.

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.

arr = [1, 2, 2, 1, 1, 3]   →  true    (1 three times, 2 twice, 3 once)
arr = [1, 2]               →  false   (both appear once)

Constraints

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