Ezvor

1852. Distinct Numbers in Each Subarray

MediumArray Preparing judge… LeetCode
ArrayHash TableSliding Window

Hints

Hint 1
Keep a frequency map of the elements in each window.
Hint 2
When the frequency of the element is 0, remove it from the map.
Hint 3
The answer to each window is the size of the map.