1/28
Learn

Coin change with dollar amounts

In one Airbnb MLE (machine learning engineer) loop, reported in August 2026, the coding question was "a Coin Change variant, except the input wasn't integers, it was floats" (1 report). A prep site lists two more exact-sum questions for Airbnb MLE rounds (2 sources). Level 1 reads like this:

Amounts and coin values are dollars, as floats, like 0.25. Write min_coins(amount, coins): the fewest coins that add up to exactly amount, or -1 if no mix of coins does. Each coin can be used any number of times.

CallReturns
min_coins(0.30, [0.10, 0.25])3
min_coins(0.65, [0.05, 0.10, 0.25])4
min_coins(0.07, [0.05])-1

Be ready to say why taking the biggest coin each time fails for some coin sets, and what your solution costs.

Thirty cents is three dimes. A quarter leaves 5 cents, and no coin fits. Level 2 adds count_ways(amount, coins): how many combinations make the amount, with order ignored, so 5 + 1 and 1 + 5 are one. Level 3 returns the coins of one best answer, and level 4 gives the till a limited supply of each coin.

You don't write it yet. The table that solves it may be familiar, but the floats are where working solutions break, so the lesson starts with whole cents and then builds the table. At the end you solve the whole problem, level by level, in an interview simulation with a 45-minute timer.

This is the first dynamic programming lesson. Its table is a list indexed by the amount, used the way the earlier lessons used a dict. The lesson on dynamic programming on a table grows the same idea into two dimensions.