All challenges

Algorithm challenge · DSA

Coin Change

Difficulty

medium

Time

~30m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#dynamic-programming
Mission file // read carefullymedium

Given coin denominations coins and a total amount, return the fewest coins needed to make amount, or -1 if impossible. Unlimited coins of each type.

coins = [1,2,5], amount = 11  =>  3   (5+5+1)

Build with

coinChange(coins: int[], amount: int) → int
PythonJavaScriptTypeScriptGoJavaC++Rust
4 tests · 1 hidden
Auto-graded on submit
Start challenge

Sign in to save your progress.