Problem 3672 · Medium

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.

Open the interactive visualisation