Is there a fast algorithm for computing the rolling mode of an array of integers?
Maintain two data structures as you move along.


A hash $H$ table of frequencies.
An array of sets $A$ containing the integers in each frequency. So $A[1]$ is the set of all integers that occur once in the window, $A[2]$ all that occur twice, etc.


When you move the window, you need to do two updates, one to increment a frequency of the new integer and one to decrement the frequency of the integer that left the window. For both the process is similar:


Look up the frequency $f$ of the integer in $H$ in $O(1)$ time.
Remove the integer from set $A[f]$ and add it to $A[f \pm 1]$ in $O(1)$ time (using hash sets).
Increment/decrement the frequency in $H$ in $O(1)$ time.


You don't need to track $A[0]$. The mode is any of the integers in the highest $A[f]$ which is non-empty, which you can keep track of in $O(1)$ time.

The total runtime is $O(n)$.