Ezvor

3837. Delayed Count of Equal Elements

MediumArray Preparing judge… LeetCode
ArrayHash TableCounting

Hints

Hint 1
Use a hashmap.
Hint 2
Traverse from left to right, and at index i insert nums[i + k + 1] (if it exists) into the hashmap.
Hint 3
For the current index i, count how many of its occurrences are in the hashmap and push it into the result.
Hint 4
Reverse the resulting list and return it.