2dbi
Home/Intuit/Coin Change
IIntuit·DSASDE-2Online Assessment

Coin Change

Problem

Given coin denominations and an amount, return the fewest coins needed to make the amount, or -1.

Example

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

Constraints

  • 1 ≤ amount ≤ 10^4

Approach

Unbounded-knapsack DP. Reported Intuit question (often alongside the craft demo).

added 6 days ago
LeadersAccount