AAlgoLoopSpaced repetition for LeetCode

Greedy

A greedy algorithm makes the locally best choice at each step and never reconsiders — fast, but only correct when local optimality guarantees a global optimum. The hard part is proving (or trusting) that the greedy choice is safe.

24 LeetCode problems solved with the Greedy pattern. Practice them with spaced repetition so the pattern sticks.

See the full solution

The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.

Start free →