Skip to content

Latest commit

 

History

History
executable file
·
24 lines (11 loc) · 671 Bytes

Min_Number_Of_Coins_For_Change.md

File metadata and controls

executable file
·
24 lines (11 loc) · 671 Bytes

Min Number Of Coins For Change

Problem Statement

Given an array of positive integers representing coin denominations and a single non-negative integer representing a target amount of money, implement a function that returns the smallest number of coins needed to make change for that target amount using the given coin denominations. Note that an unlimited amount of coins is at your disposal. If it is impossible to make change for the target amount, return -1.

Sample input: 7, [1, 5, 10]

Sample output: 3 (2x1 + 1x5)

Explanation

We can use a Stack here

Solution

Check this Python code.