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

Greedy problems
#ProblemDifficultyVideoAI round
1Gas StationMediumAI round
2Largest NumberMedium—AI round
3CandyHardAI round
4Increasing Triplet SubsequenceMedium—
5Minimum Number of Arrows to Burst BalloonsMedium—
6Can Place FlowersEasy—
7Longest PalindromeEasy—
8Minimum Add to Make Parentheses ValidMedium—
9Two City SchedulingMedium—
10Maximum SwapMedium—
11Maximum Units on a TruckEasy—
12Lemonade ChangeEasy—
13Minimum Increment to Make Array UniqueMedium
14Using a Robot to Print the Lexicographically Smallest StringMedium—
15Maximum Odd Binary NumberVery easy

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 round