~/boss / window-king

Sliding window maximum (monotonic deque)

The Window King

Who rules each window? Crown the right king, every step.

Loading the fight…

How to beat it

Keep a line of candidates, strongest at the front. A newcomer kicks every weaker monster off the back (they can never win again), then joins. If the front slid out of the window, drop it. The front is the king.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/sliding-window-maximum there. Sign in with your email to keep your progress on every device.

More bosses

esc