Stack & Queue
Use a stack to remember the most recent unfinished thing, or a queue to handle things in arrival order. The tell is matching, nesting, or finding the next greater item, as in Valid Parentheses and Daily Temperatures. It often replaces a repeated rescan with one pass.
28 problems · 6 with a video · 3 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Valid Parentheses | Easy | AI round | |
| 2 | Largest Rectangle in Histogram | Hard | — | |
| 3 | Daily Temperatures | Medium | AI round | |
| 4 | Decode String | Medium | AI round | |
| 5 | Maximal Rectangle | Hard | — | |
| 6 | Remove K Digits | Medium | — | |
| 7 | Next Greater Element I | Easy | ||
| 8 | First Unique Character in a String | Easy | ||
| 9 | Asteroid Collision | Medium | — | |
| 10 | Sum of Subarray Minimums | Medium | — | |
| 11 | Remove Duplicate Letters | Medium | — | |
| 12 | Next Greater Element II | Medium | — | |
| 13 | Evaluate Reverse Polish Notation | Medium | — | |
| 14 | 132 Pattern | Medium | — | |
| 15 | Maximum Sum Circular Subarray | Medium | — | |
| 16 | Minimum Remove to Make Valid Parentheses | Medium | — | |
| 17 | Remove All Adjacent Duplicates In String | Easy | — | |
| 18 | Basic Calculator | Hard | — | |
| 19 | Simplify Path | Medium | — | |
| 20 | Basic Calculator II | Medium | — | |
| 21 | Remove All Adjacent Duplicates in String II | Medium | — | |
| 22 | Maximum Binary Tree | Medium | ||
| 23 | Car Fleet | Medium | — | |
| 24 | Find the Winner of the Circular Game | Medium | — | |
| 25 | Remove Outermost Parentheses | Easy | — | |
| 26 | Verify Preorder Sequence in Binary Search Tree | Medium | — | |
| 27 | Basic Calculator III | Hard | — | |
| 28 | Minimum Number of Visited Cells in a Grid | Very hard | — |
Sort by what interviews ask
Sign in to see how many companies ask each problem, sort all 500 by it or by likes, and tick off what you solve.
Practice in an AI round
Three of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.
Practice Valid Parentheses in an AI roundYour first AI round is free.