Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Problem 3: Unique Number of Occurrences (easy)
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Given an array of integers, determine if the number of times each distinct integer appears in the array is unique.

In other words, the occurrences of each integer in the array should be distinct from the occurrences of every other integer.

Examples:

    • Input: [4, 5, 4, 6, 6, 6]
    • Expected Output: true
    • Justification: The number 4 appears 2 times, 5 appears 1 time, and 6 appears 3 times. All these occurrences (1, 2, 3) are unique.
    • Input: [7, 8, 8, 9, 9, 9, 10, 10]
    • Expected Output: false

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible