Slug: deque-max-01 · Paired reading: Chapter 17
Prompt
fn max_sliding_window(nums: &[i32], k: usize) -> Vec<i32> — maximum of every
contiguous window of length k. O(n) with a monotonic deque of indices.
The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).
Don’t have the book yet? The landing page stays open — purchase unlocks this gym.
intermediate · order 98
Slug: deque-max-01 · Paired reading: Chapter 17
fn max_sliding_window(nums: &[i32], k: usize) -> Vec<i32> — maximum of every
contiguous window of length k. O(n) with a monotonic deque of indices.