Back to all patterns

Greedy

4 problems • Practice on LeetCode to earn credits

About This Pattern

Master the Greedy pattern by practicing these problems organized by difficulty.Focus on the Key Signals - these are the indicators that tell you when to use this pattern.

Medium (4)

Jump Game

Determine if you can reach the last index from the first.

Key Signals:

Track farthest reachableUpdate at each positionGreedy choice
Gas Station

Find starting gas station index to complete circular route.

Key Signals:

Check total feasibilityReset start on negativeSingle pass
Merge Triplets to Form Target Triplet

Check if target triplet can be formed by merging valid triplets.

Key Signals:

Filter invalid tripletsCheck if target achievableGreedy selection
Partition Labels

Partition string into as many parts as possible with each letter in at most one part.

Key Signals:

Track last occurrenceExtend partition boundarySplit when reached