Problem Statement:
You have 9 dollars. The store sells sandwiches for 5 dollars, drinks for 3 dollars, and chips for 1 dollar. If you want to spend all of your money and exit the store with the least amount of items, how much of each item should you get?
I understand the concept, obviously you should get 1 sandwich, 1 drink, and 1 bag of chips. but is there a name for that process?
9/5 = 1 r4
4/3 = 1 r1
1/1 = 1 r0
Is there an easier way to implement this while coding, for any general values of the initial amount and the item prices?