Skip to main content
Coin Change II | AlgoCracked
AlgoCracked
ProblemsCoin Change II
Medium62.0% acceptance
Dynamic ProgrammingArrayKnapsack

Coin Change II

You are given an integer amount and an array of distinct coins (each an unlimited-supply denomination). Return the number of distinct combinations of coins that add up exactly to amount . Combinations that differ only in order count once. If no combination works, return 0 ; there is always one way to make amount 0 (use no coins). Input format Input is [amount, coins] , e.g. [5,[1,2,5]] .

Loading workspace…