Cody

Problem 1941. Lowest sum from a group of digits

Solution 2653736

Submitted on 5 Jul 2020 by Nikolaos Nikolaou
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
x = 0:3; y_correct = 33; assert(isequal(lowest_number(x),y_correct))

m1 = 10 m2 = 23 y = 33

2   Pass
x=[1 2 3 7 8 9] ; y_correct = 417; assert(isequal(lowest_number(x),y_correct))

m1 = 138 m2 = 279 y = 417

3   Pass
x=[7 8 9 7 8 9] ; y_correct = 1578; assert(isequal(lowest_number(x),y_correct))

m1 = 789 m2 = 789 y = 1578

4   Pass
x = 0:9; y_correct = 34047; assert(isequal(lowest_number(x),y_correct))

m1 = 10468 m2 = 23579 y = 34047

5   Pass
x=7*[ones(1,5) zeros(1,7)]; y_correct=1400084; assert(isequal(lowest_number(x),y_correct))

m1 = 700007 m2 = 700077 y = 1400084

6   Pass
x=[ones(1,8) zeros(1,10)]; y_correct=200000222; assert(isequal(lowest_number(x),y_correct))

m1 = 100000111 m2 = 100000111 y = 200000222

7   Pass
x = [0:9 1:8]; y_correct = 225802467; assert(isequal(lowest_number(x),y_correct))

m1 = 102345678 m2 = 123456789 y = 225802467

8   Pass
x=[randperm(10)-1 randperm(6)]; y_correct=22580247; assert(isequal(lowest_number(x),y_correct))

m1 = 10234568 m2 = 12345679 y = 22580247

Suggested Problems

More from this Author80

Community Treasure Hunt

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

Start Hunting!