PythiloHard · 40 min · Task 87 of 100 · progress kept in this browser

Sliding window maximum

Return the maximum in every consecutive window of width k. 1 <= k <= len(items), except an empty input returns []. Use linear time.

from collections import deque
values = [1, 3, 2]
candidates = deque([1, 2])
print(values[candidates[0]])
Your task

Return the maximum in every consecutive window of width k. 1 <= k <= len(items), except an empty input returns []. Use linear time.