data_structures.queues.monotonic_queue

Attributes

arr

expect

window_size

Functions

max_sliding_window(→ list[float])

Given an array of integers nums, there is a sliding window of size k which is moving

Module Contents

data_structures.queues.monotonic_queue.max_sliding_window(arr: list[float], window_size: int) list[float]

Given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. Each time the sliding window of length window_size moves right by one position. Return the max sliding window. >>> max_sliding_window(arr, window_size) == expect True

data_structures.queues.monotonic_queue.arr
data_structures.queues.monotonic_queue.expect = [3, 3, 5, 5, 6, 7]
data_structures.queues.monotonic_queue.window_size = 3