Back to all patterns

Monotonic Stack

2 problems • Practice on LeetCode to earn credits

About This Pattern

Master the Monotonic Stack pattern by practicing these problems organized by difficulty.Focus on the Key Signals - these are the indicators that tell you when to use this pattern.

Medium (1)

Daily Temperatures

Given temperatures, return array showing days until warmer temperature.

Key Signals:

Next greater elementStack stores indicesDecreasing stack

Hard (1)

Largest Rectangle In Histogram

Find the largest rectangle area in a histogram.

Key Signals:

Track increasing heightsPop when smaller foundCalculate area on pop