Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Sliding Window Max

Python data engineering interview problem. Difficulty: intermediate. Pattern: Sliding Window. About 14 minutes. Part of the Pro drill bank.

Maximum of every contiguous window of size k. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement max_sliding_window(nums: list, k: int) -> list.

Requirements

  • Return one max per window.

Constraints

  • 1 <= k <= len(nums).

Examples

Input: max_sliding_window([1, 3, -1, -3, 5, 3, 6, 7], 3) Output: [3, 3, 5, 5, 6, 7] Deque keeps candidates.

Topics: lakebench, python, deque, max.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Sliding Window Max

Interview-style drill: Maximum of every contiguous window of size k.

Implement `max_sliding_window(nums: list, k: int) -> list`. Example: `[1, 3, -1, -3, 5, 3, 6, 7], 3` → `[3, 3, 5, 5, 6, 7]`. Keep the harness.