Skip to content
Advertisement

Tag: coin-change

Coin change logic

Im stuck at this problem about the change of a vending machine (using 10ct, 20 ct, 50ct, 100ct and 200ct-coins.) So lets say coffee costs 40cts. The user throws in 2€ (labeled 200cts). Now im supposed to figure out how the change of 160cts is given back to the user. There are 2 conditions: A) Taking the shortest combination, but

Advertisement