Greedy Algorithms
Make the locally best choice at each step and never look back, useful when local optima add up to a global optimum.
Greedy Algorithms Practice Problems
Easy
2 problemsMedium
8 problems- 72medium
Jump Game
Check whether you can reach the last position of an array given each element's max jump length.
- 73medium
Jump Game II
Find the minimum number of jumps needed to reach the last position of an array.
- 74medium
Gas Station
Find the starting gas station that lets you complete a full circuit without running out of fuel.
- 75medium
Task Scheduler
Find the minimum time needed to finish a list of tasks with a required cooldown between repeats.
- 76medium
Partition Labels
Split a string into the most parts possible so each letter appears in only one part.
- 77medium
Non-overlapping Intervals
Find the fewest intervals to remove so none of the remaining intervals overlap.
- 213medium
Best Time to Buy and Sell Stock II
Maximize profit from a stock by buying and selling as many times as you like.
- 214medium
Minimum Number of Arrows to Burst Balloons
Find the fewest arrows needed to burst every balloon interval on a line.
Hard
2 problemsRelated concepts
| Topic | Description |
|---|---|
| Dynamic Programming | Break a problem into overlapping subproblems and reuse their answers to avoid recomputing the same work. |
| Sliding Window | Solve fixed-window problems: maximum sum of k elements, moving averages, and O(n) updates as the window slides. |
| Two Pointers | Scan a sorted array or string from both ends at once to find pairs, remove duplicates, or reverse data in O(n). |
| Binary Search | Cut a sorted range in half on every step to find a value or boundary in O(log n) instead of checking one by one. |
| Depth-First Search | Explore as far as possible down one path before backtracking, used to walk trees, graphs, and grids. |
| Breadth-First Search | Explore level by level from a starting point, the go-to way to find the shortest path in an unweighted graph. |