Unique Number of Occurrences

Given an integer array arr, return true when every distinct value occurs a different number of times. Return false when any two distinct values have the same…

Given an integer array `arr`, return `true` when every distinct value occurs a different number of times. Return `false` when any two distinct values have the same frequency.

- `1 <= arr.length <= 10^5` - `-10^9 <= arr[i] <= 10^9` - The interactive visualizer accepts at most 12 values; longer valid arrays are execution-only.

Example 1: input arr = [1, 2, 2, 1, 1, 3]; output true. The frequencies are 3, 2, and 1, so no count repeats.

Example 2: input arr = [1, 2]; output false. Both distinct values occur once.

Category: Arrays & Hashing. Topic: arrays. Difficulty: Easy. Patterns: hashing.