Implement prototype(loads: list[int], width: int) -> list[int] and solve with the same signature. Return the maximum of each full contiguous window in starting-index order. Integers may be negative. Empty input or width > len(loads) returns []. Raise ValueError for width <= 0, even with empty input.

Examples: ([9, 8, 7, 6], 2) returns [9, 8, 7]; ([4, 4, 1, 4], 2) returns [4, 4, 4].

Prototype: scan each window. Final: maintain candidate indices in a monotonic deque, targeting O(n) time and O(width) auxiliary space. Preserve inputs, including on failure.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.