Sliding Window Maximum, five ways

Try:
CALL
1 / 1

Code

The highlighted line runs next. The pill shows the live values in the running call.

Cost

Work done so far, and how the five solutions compare

nums and output

Tinted cells are the current window

Keyboard: ← → step, Space play or pause. 1 to 10 whole numbers between −99 and 99, and 1 ≤ k ≤ n. The heap view follows Python’s heapq on (−value, index) tuples; Java’s PriorityQueue and C++’s priority_queue may break ties differently, but the top value, and so the output, is the same.