Cody

# Problem 48. Making change

Solution 2194532

Submitted on 6 Apr 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
a = [257.68]; b = [2 1 0 0 1 1 0 1 0 1 1 3]; out = makingChange(a); assert(isequal(out(:), b(:)))

x = 1 numberofcoins = 2 a = 57.6800 x = 2 numberofcoins = 1 a = 7.6800 x = 3 numberofcoins = 0 a = 7.6800 x = 4 numberofcoins = 0 a = 7.6800 x = 5 numberofcoins = 1 a = 2.6800 x = 6 numberofcoins = 1 a = 0.6800 x = 7 numberofcoins = 0 a = 0.6800 x = 8 numberofcoins = 1 a = 0.1800 x = 9 numberofcoins = 0 a = 0.1800 x = 10 numberofcoins = 1 a = 0.0800 x = 11 numberofcoins = 1 a = 0.0300 x = 12 numberofcoins = 3 a = 6.8140e-15

2   Fail
a = [135.01]; b = [1 0 1 1 1 0 0 0 0 0 0 1]; out = makingChange(a); assert(isequal(out(:), b(:)))

x = 1 numberofcoins = 1 a = 35.0100 x = 2 numberofcoins = 0 a = 35.0100 x = 3 numberofcoins = 1 a = 15.0100 x = 4 numberofcoins = 1 a = 5.0100 x = 5 numberofcoins = 1 a = 0.0100 x = 6 numberofcoins = 0 a = 0.0100 x = 7 numberofcoins = 0 a = 0.0100 x = 8 numberofcoins = 0 a = 0.0100 x = 9 numberofcoins = 0 a = 0.0100 x = 10 numberofcoins = 0 a = 0.0100 x = 11 numberofcoins = 0 a = 0.0100 x = 12 numberofcoins = 0 a = 0.0100 answer = 1.0000 0 1.0000 1.0000 1.0000 0 0 0 0 0 0 1.0000

Assertion failed.

3   Fail
a = [10035.99]; b = [100 0 1 1 1 0 0 1 1 2 0 4]; out = makingChange(a); assert(isequal(out(:), b(:)))

x = 1 numberofcoins = 100 a = 35.9900 x = 2 numberofcoins = 0 a = 35.9900 x = 3 numberofcoins = 1 a = 15.9900 x = 4 numberofcoins = 1 a = 5.9900 x = 5 numberofcoins = 1 a = 0.9900 x = 6 numberofcoins = 0 a = 0.9900 x = 7 numberofcoins = 0 a = 0.9900 x = 8 numberofcoins = 1 a = 0.4900 x = 9 numberofcoins = 1 a = 0.2400 x = 10 numberofcoins = 2 a = 0.0400 x = 11 numberofcoins = 0 a = 0.0400 x = 12 numberofcoins = 3 a = 0.0100 answer = 100.0000 0 1.0000 1.0000 1.0000 0 0 1.0000 1.0000 2.0000 0 1.0000

Assertion failed.