YUNOVA · Data Structures & Algorithms · Module 13: Advanced data structures

Monotonic stack and deque problems

Notes for offline study · 30 November 2026

Monotonic stack and deque problems

Key points

  • A monotonic stack keeps elements in increasing or decreasing order.
  • It finds the next greater or smaller element for every item in O(n).
  • A monotonic deque gives the sliding window maximum in O(n).

Free on YUNOVA · yunova.in · Sign in to add your own lesson notes to this sheet.