# Implementing supplies in Coin change problem

I started an algorithm course in C two months ago, for the last weeks I've been trying to solve this problem , i ran out of time but I cannot find an acceptable solution. Basically It's a coin change problem, Given a sum (S) I need to find (and print) the combination that uses the least amount of coins, I can only use coins that are available. For example: INPUT: S=10 Coins={2,3,4,5} Supply={1,3,1,0} OUTPUT: 3 3 4

I've been able to solve the normal coin change problem but I can't seem to find a way to manage supplies so that the program doesn't use a coin when its supply=0.

• Welcome to Computer Science! The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you!
– Raphael
Sep 26, 2017 at 19:53
• How does your current algorithm work? The canonical algorithm for this problem should be easy to extend for limited supplies.
– Raphael
Sep 26, 2017 at 19:53
• Where did you get stuck, in extending your current algorithm? We're happy to help you understand the concepts but just solving exercises for you is unlikely to achieve that. You might find this page helpful in improving your question. Have you tried dynamic programming? Check out our reference material on the subject: cs.stackexchange.com/tags/dynamic-programming/info
– D.W.
Sep 27, 2017 at 0:46