Ezvor

3672. Sum of Weighted Modes in Subarrays

MediumArray Preparing judge… LeetCode
ArrayHash TableSliding WindowCountingOrdered Set

Hints

Hint 1
Use a sliding window.
Hint 2
Maintain the max frequency of the current window of length k using a data structure.
Hint 3
Maintain another data structure for values that have a given frequency.