Cody

Problem 48. Making change

Solution 1757573

Submitted on 22 Mar 2019
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(:)))

b = 2 temp = 57.6800 b = 2 1 temp = 7.6800 b = 2 1 0 temp = 7.6800 b = 2 1 0 0 temp = 7.6800 b = 2 1 0 0 1 temp = 2.6800 b = 2 1 0 0 1 1 temp = 0.6800 b = 2 1 0 0 1 1 0 temp = 0.6800 b = 2 1 0 0 1 1 0 1 temp = 0.1800 b = 2 1 0 0 1 1 0 1 0 temp = 0.1800 b = 2 1 0 0 1 1 0 1 0 1 temp = 0.0800 b = 2 1 0 0 1 1 0 1 0 1 1 temp = 0.0300 b = 2 1 0 0 1 1 0 1 0 1 1 3 temp = 6.8123e-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(:)))

b = 1 temp = 35.0100 b = 1 0 temp = 35.0100 b = 1 0 1 temp = 15.0100 b = 1 0 1 1 temp = 5.0100 b = 1 0 1 1 1 temp = 0.0100 b = 1 0 1 1 1 0 temp = 0.0100 b = 1 0 1 1 1 0 0 temp = 0.0100 b = 1 0 1 1 1 0 0 0 temp = 0.0100 b = 1 0 1 1 1 0 0 0 0 temp = 0.0100 b = 1 0 1 1 1 0 0 0 0 0 temp = 0.0100 b = 1 0 1 1 1 0 0 0 0 0 0 temp = 0.0100 b = 1 0 1 1 1 0 0 0 0 0 0 0 temp = 0.0100

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(:)))

b = 100 temp = 35.9900 b = 100 0 temp = 35.9900 b = 100 0 1 temp = 15.9900 b = 100 0 1 1 temp = 5.9900 b = 100 0 1 1 1 temp = 0.9900 b = 100 0 1 1 1 0 temp = 0.9900 b = 100 0 1 1 1 0 0 temp = 0.9900 b = 100 0 1 1 1 0 0 1 temp = 0.4900 b = 100 0 1 1 1 0 0 1 1 temp = 0.2400 b = 100 0 1 1 1 0 0 1 1 2 temp = 0.0400 b = 100 0 1 1 1 0 0 1 1 2 0 temp = 0.0400 b = 100 0 1 1 1 0 0 1 1 2 0 3 temp = 0.0100

Assertion failed.