Skip to content

[Sliding Window] Sliding Window Maximum #17

@sudosf

Description

@sudosf

Problem

Given an array and window size k, return the max value in each window as the window slides from left to right.

References

Difficulty

🔴 Hard

Companies

Amazon, Google, DE Shaw

Notes

Language: Java
Naive O(nk) won't pass. Use a monotonic deque (ArrayDeque) for O(n).

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraysArray problemshardHard difficultysliding-windowSliding window pattern

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions