Sum of Weighted Modes in Subarrays
Slide a window of length k, find its most frequent value with ties to the smaller one, and sum each mode weighted by its count.
Slide a window of length k, find its most frequent value with ties to the smaller one, and sum each mode weighted by its count.