Greedy coding challenges

Practise greedy with 5 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Easy · 2 Medium · 2 Hard · 1

Skills you'll practise: Coin changeGreedy algorithmsGreedy fixesInvariantsMath reasoningPrefix maximaReachable sumsRunning maximumSorting firstTwo pointers
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
226
Challenges
2
Solutions shared
3
Languages

All challenges

Search by topic, language, or difficulty.

5 challenges
Hard

Trapping Rain Water

Compute how much rain water an elevation map holds.

You'll learn Two pointersPrefix maxima
AdvancedArraysCompetitive-programmingGreedy
No solutions yet
Easy

Cash: Fewest Coins

Give change with as few U.S. coins as possible.

You'll learn Greedy algorithmsCoin change
BeginnerGreedyStudent-beginnermath
No solutions yet
Medium

Empty Two Coin Piles

Decide whether paired removals can empty two piles.

You'll learn Math reasoningInvariants
Greedymath
No solutions yet
Medium

Smallest Missing Coin Sum

Find the first positive amount that cannot be made from the available coins.

You'll learn Reachable sumsSorting first
ArraysGreedy
No solutions yet
Easy

Make an Array Nondecreasing

Find the fewest increments needed so each value is at least the previous one.

You'll learn Greedy fixesRunning maximum
ArraysGreedy
No solutions yet