There's an ATM with unlimited money in bills of 10, 20, 50, 100, 200, and 500 dollars. You're given an amount of money
n to withdraw with
Try to find the minimal number of bills that must be used to cash out
n, or output
-1 if it's impossible.
solve(1250) => 4 bills (500x2, 50x1, 200x1)
solve 1500 => 3 bills ($500x3)
Want to propose a challenge idea for a future post? Email email@example.com with your suggestions!