Data Structures19 sections · 729 units
Open in Course

Recognizing Stack Problems

Pattern hints

Look for these signals:

1.1. "Matching pairs" or "balanced": parentheses, tags, brackets

2.2. "Next greater/smaller": direct monotonic stack

3.3. "How far can X extend": histogram pattern

4.4. "Most recent element satisfying condition": basic stack

5.5. "Process in reverse order": undo, backtracking

When you see these, think stack before trying other approaches.