Greedy algorithm to find minimum number of coins

Given a value and given a collection that contains all positive coins. Our goal is to find minimum coins that sum is equal to given value.

Collection [] = {6, 3, 1, 4}
Value  : 23
Output : 6  6  6  4  1

Value  : 13
Output :  6  6  1
[Note 6 6 1 is minimum coin which sum is to 13]

Here given code implementation process.




Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2022, kalkicode.com, All rights reserved