How to Solve '1207 Unique Number of Occurrences' on LeetCode? - Javascript

preview_player
Показать описание
Do you need more help with coding?
════════════════════════════
════════════════════════════

How to Solve "1207 Unique Number of Occurrences" on LeetCode?

Problem: #1207 Unique Number of Occurrences
Difficulty: Easy
Language: Javascript

Strategy: Hash Tables
Time Complexity: O(n)
Space Complexity: O(n)

Pseudo Code:
1. Create map object.
2. Loop through arr.
a. Create condition if the current index value is NOT inside the map,
i. add the current index value and set the value equal to 1.
b. Else.
i. Increment the value for that key.
3. Create count variable and set equal the the values of map (as an array).
4. Return true if the length of count is equal to the size of a new set of count.

GitHub Repo:

Let's Connect 💯:
════════════════════════════
Рекомендации по теме