Greedy Algorithms
This is a premium interview-preparation course built around the single hardest skill in greedy problems: **knowing when greedy is correct**. Anyone can sort an array and grab the best-looking option; the interview signal is being able to say *why* that choice can never block the optimum. You will start with the mental model — the greedy-choice property, optimal substructure, and the exchange argument — and then work through curated problems grouped by the patterns interviewers actually test: interval greedy, scheduling, array reachability, string construction, heap-assisted greedy, and advanced sorting-based greedy. Every problem teaches the insight first, proves the greedy choice, then shows a clean Java 17 implementation.
27
Curated lessons
7
Learning modules
8h 2m
Est. study time
10
Target companies
What you'll learn
- Recognise the tell-tale signs of a greedy problem and distinguish them from problems that require dynamic programming.
- Justify a greedy choice with an informal exchange argument — the proof interviewers listen for.
- Apply the core greedy templates: sort-then-sweep intervals, earliest-deadline scheduling, farthest-reach arrays, and heap-assisted selection.
- Communicate correctness the way senior and staff interviewers expect: greedy insight, why it works, complexity.
Your progress
0 / 27
problems completed
27 available now · keep going!
Mark lessons complete as you work through them. Progress is saved on this device and syncs to your account when you sign in.
Learning roadmap
Work top to bottom — each module builds on the last.
- 1
Greedy Fundamentals
Greedy-choice property + optimal substructureThe mental model: what makes a greedy choice safe, and how to prove it with an exchange argument before writing any code.
6/6 problems48m - 2
Interval Greedy
Sort by endpoint, then sweep and compare boundariesSort by start or end, then sweep — the interval family behind merging, overlap removal, and point covering.
4/4 problems1h 13m - 3
Scheduling
Sort by deadline/end, allocate with a heap or counterOrder events by the right key — start, end, or deadline — to pack the most work into limited time or resources.
4/4 problems1h 17m - 4
Array Greedy
Maintain a running frontier / balance in one sweepTrack a single running best — farthest reach, running balance, or local demand — in one linear pass.
4/4 problems1h 27m - 5
String Greedy
Last-occurrence boundaries + monotonic stack / frequencyUse last-occurrence and frequency information to cut, prune, or arrange characters optimally.
3/3 problems57m - 6
Heap + Greedy
Greedy selection with a heap to swap out the worst pickLet a priority queue undo or upgrade earlier greedy choices, keeping the best feasible set at every step.
3/3 problems1h 23m - 7
Advanced Greedy
Clever sort order + insertion / two-pointer pairingNon-obvious sort keys and two-pointer pairings that turn a hard construction into a clean linear or log-linear pass.
3/3 problems57m
Modules
7 themed modules from fundamentals to advanced.
Greedy Fundamentals
The mental model: what makes a greedy choice safe, and how to prove it with an exchange argument before writing any code.
Interval Greedy
Sort by start or end, then sweep — the interval family behind merging, overlap removal, and point covering.
Scheduling
Order events by the right key — start, end, or deadline — to pack the most work into limited time or resources.
Array Greedy
Track a single running best — farthest reach, running balance, or local demand — in one linear pass.
String Greedy
Use last-occurrence and frequency information to cut, prune, or arrange characters optimally.
Heap + Greedy
Let a priority queue undo or upgrade earlier greedy choices, keeping the best feasible set at every step.
Advanced Greedy
Non-obvious sort keys and two-pointer pairings that turn a hard construction into a clean linear or log-linear pass.
Full curriculum
21 problems and 6 concept lessons in learning order.
- 1What Is a Greedy Algorithm?Greedy Fundamentals Concept
- 2The Greedy-Choice PropertyGreedy Fundamentals Concept
- 3Optimal SubstructureGreedy Fundamentals Concept
- 4The Exchange ArgumentGreedy Fundamentals Concept
- 5Greedy vs Dynamic ProgrammingGreedy Fundamentals Concept
- 6Common Greedy Interview PatternsGreedy Fundamentals Concept
- 7Merge IntervalsInterval GreedyMedium
- 8Non-overlapping IntervalsInterval GreedyMedium
- 9Insert IntervalInterval GreedyMedium
- 10Minimum Number of Arrows to Burst BalloonsInterval GreedyMedium
- 11Meeting RoomsSchedulingEasy
- 12Meeting Rooms IISchedulingMedium
- 13Task SchedulerSchedulingMedium
- 14Maximum Number of Events That Can Be AttendedSchedulingMedium
- 15Jump GameArray GreedyMedium
- 16Jump Game IIArray GreedyMedium
- 17Gas StationArray GreedyMedium
- 18CandyArray GreedyHard
- 19Partition LabelsString GreedyMedium
- 20Remove Duplicate LettersString GreedyMedium
- 21Reorganize StringString GreedyMedium
- 22Course Schedule IIIHeap + GreedyHard
- 23Furthest Building You Can ReachHeap + GreedyMedium
- 24IPOHeap + GreedyHard
- 25Queue Reconstruction by HeightAdvanced GreedyMedium
- 26Hand of StraightsAdvanced GreedyMedium
- 27Boats to Save PeopleAdvanced GreedyMedium