I’m trying to create “make-change” that will return a ls of coins whose sum = the input, and it needs to contain the least number of coins possible.
Ex: (make-change 99)
=> (quarter quarter quarter dime dime penny penny penny penny)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s the lines along which
make-changeshould operate:consthe largest coin you can use onto the result of(make-change (- x value))wherevalueis the amount of the coin that you just used.You can tell this procedure will terminate, since the amount will become smaller and smaller via step 2 until it is finally amenable to concluding with step 1.