Cody

Problem 48. Making change

Solution 891302

Submitted on 18 May 2016 by david hansen
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(:)))

ans = 2.5768 2.0000 ans = 1.1536 1.0000 ans = 0.3840 0 ans = 0.7680 0 ans = 1.5360 1.0000 ans = 1.3400 1.0000 ans = 0.6800 0 ans = 1.3600 1.0000 ans = 0.7200 0 ans = 1.8000 1.0000 ans = 1.6000 1.0000 ans = 3 3

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

ans = 1.3501 1.0000 ans = 0.7002 0 ans = 1.7505 1.0000 ans = 1.5010 1.0000 ans = 1.0020 1.0000 ans = 0.0050 0 ans = 0.0100 0 ans = 0.0200 0 ans = 0.0400 0 ans = 0.1000 0 ans = 0.2000 0 ans = 1 1

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

ans = 100.3599 100.0000 ans = 0.7198 0 ans = 1.7995 1.0000 ans = 1.5990 1.0000 ans = 1.1980 1.0000 ans = 0.4950 0 ans = 0.9900 0 ans = 1.9800 1.0000 ans = 1.9600 1.0000 ans = 2.4000 2.0000 ans = 0.8000 0 ans = 4 4

Suggested Problems

More from this Author95

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!