1/20
Loading...
🤖Vending Machine Job
Customer needs 2730 won change! Can we give change with coins in the machine?
Loading...
Customer needs 2730 won change! Can we give change with coins in the machine?
You work at a convenience store vending machine. The machine has limited coin quantities: • 1000 won: 3 • 500 won: 5 • 100 won: 10 • 10 won: 10 When giving change, use the **minimum number of coins**. But you can only use coins in the machine!
amount = 2730, coins = [1000×3, 500×5, 100×10, 10×10]
8
1000×2 + 500×1 + 100×2 + 10×3 = 8 coins
amount = 3500, coins = [1000×3, 500×0, 100×0, 10×0]
-1
Cannot make 3500 with only 3×1000 (3000)