Greedy
At each step take the choice that looks best right now, and rely on an argument that it never hurts the final answer. The tell is a sorted order or a running best, as in Gas Station and Candy. When it applies, it is simple and fast.
15 problems · 4 with a video · 3 to practice in an AI round
| # | Problem | Difficulty | Video | AI round |
|---|---|---|---|---|
| 1 | Gas Station | Medium | AI round | |
| 2 | Largest Number | Medium | — | AI round |
| 3 | Candy | Hard | AI round | |
| 4 | Increasing Triplet Subsequence | Medium | — | |
| 5 | Minimum Number of Arrows to Burst Balloons | Medium | — | |
| 6 | Can Place Flowers | Easy | — | |
| 7 | Longest Palindrome | Easy | — | |
| 8 | Minimum Add to Make Parentheses Valid | Medium | — | |
| 9 | Two City Scheduling | Medium | — | |
| 10 | Maximum Swap | Medium | — | |
| 11 | Maximum Units on a Truck | Easy | — | |
| 12 | Lemonade Change | Easy | — | |
| 13 | Minimum Increment to Make Array Unique | Medium | ||
| 14 | Using a Robot to Print the Lexicographically Smallest String | Medium | — | |
| 15 | Maximum Odd Binary Number | Very easy |
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 Gas Station in an AI roundYour first AI round is free.