CodeMosa

Master LeetCode Patterns

4 Problems

Monotonic Stack Practice Problems

Next greater element, histogram area, and stack-of-indices techniques that scan once.

Back to Collections

Relevant Patterns

#
Study these pattern guides before tackling the problems. Understanding the core concepts will help you solve them more efficiently.

Practice Problems

#
Show 2 hints
  • Decreasing stack of indices; pop until warmer day found.
  • Answer[i] = j - i when popped by warmer j.
Show 2 hints
  • Traverse circularly via i % n while maintaining decreasing stack.
  • Only fill answers in first pass to avoid overwrites.
Medium#853
Show 2 hints
  • Sort by position descending; use stack of arrival times to target.
  • Merge when current arrival <= stack top (same fleet).
Show 2 hints
  • Maintain increasing stack of indices; compute area when current height < stack top.
  • Flush stack with sentinel at the end.

Track Your Progress

Mark problems as complete as you solve them. Come back anytime to continue where you left off.