Data Structures & AlgorithmsModerateProduct Company SDE · sliding window OA

Problem: Which problem is the standard application of the monotonic deque?

  1. A. Sliding window maximum in O(n)
  2. B. Dijkstra shortest paths
  3. C. Counting connected components
  4. D. Matrix multiplication

Correct answer: A. Sliding window maximum in O(n)

Maintaining indices in decreasing value order lets each window maximum be read from the front in O(1).

More Coding Interview Problems questions

Exams that ask this topic