HomeGreedy
Greedy
Take the locally best choice — when it's provably optimal.
18 shown
- Jump GameTrack the farthest reachable indexanimatedMedium
- Gas StationIf total gas ≥ cost, the deficit point is the startanimatedMedium
- Practice problems
- Assign CookiesSort both, feed the least greedy firstEasy
- Fractional KnapsackTake the best value per unit weight firstMedium
- Lemonade ChangeSpend the largest bills you canEasy
- Valid Paranthesis CheckerTrack a range of possible open countsHard
- N meetings in one roomAlways take the meeting that ends soonestMedium
- Jump Game - ITrack the furthest index you can reachanimatedEasy
- Jump Game IICount the boundaries of each jump levelMedium
- Minimum number of platforms required for a railwaySort arrivals and departures separatelyMedium
- Job sequencing ProblemHighest profit first, latest free slotMedium
- CandyTwo passes, one each directionHard
- Shortest Job FirstRun the shortest burst firstMedium
- Program for Least Recently Used (LRU) Page Replacement AlgorithmEvict the page unused for longestMedium
- Insert IntervalCopy, absorb the overlaps, copy the restanimatedMedium
- Merge IntervalsSort by start, extend or appendanimatedMedium
- Non-overlapping IntervalsKeep the most, so remove the fewestMedium
- Partition LabelsExtend the part to each letter's last indexMedium