Cody

# Problem 1941. Lowest sum from a group of digits

Solution 444236

Submitted on 20 May 2014 by James
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))

sano0 = 1 2 3 num0 = 1 sano0 = 1 2 0 3 n1 = 1 0 n2 = 2 3 temp = 33

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

sano0 = 1 2 3 7 8 9 num0 = 0 sano0 = 1 2 3 7 8 9 n1 = 1 3 8 n2 = 2 7 9 temp = 417

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

sano0 = 7 7 8 8 9 9 num0 = 0 sano0 = 7 7 8 8 9 9 n1 = 7 8 9 n2 = 7 8 9 temp = 1578

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

sano0 = 1 2 3 4 5 6 7 8 9 num0 = 1 sano0 = 1 2 0 3 4 5 6 7 8 9 n1 = 1 0 4 6 8 n2 = 2 3 5 7 9 temp = 34047

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

sano0 = 7 7 7 7 7 num0 = 7 sano0 = 7 7 0 0 0 0 0 0 0 7 7 7 n1 = 7 0 0 0 0 7 n2 = 7 0 0 0 7 7 temp = 1400084

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

sano0 = 1 1 1 1 1 1 1 1 num0 = 10 sano0 = Columns 1 through 16 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 Columns 17 through 18 1 1 n1 = 1 0 0 0 0 0 1 1 1 n2 = 1 0 0 0 0 0 1 1 1 temp = 200000222

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

sano0 = Columns 1 through 16 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 Column 17 9 num0 = 1 sano0 = Columns 1 through 16 1 1 0 2 2 3 3 4 4 5 5 6 6 7 7 8 Columns 17 through 18 8 9 n1 = 1 0 2 3 4 5 6 7 8 n2 = 1 2 3 4 5 6 7 8 9 temp = 225802467

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

sano0 = 1 1 2 2 3 3 4 4 5 5 6 6 7 8 9 num0 = 1 sano0 = 1 1 0 2 2 3 3 4 4 5 5 6 6 7 8 9 n1 = 1 0 2 3 4 5 6 8 n2 = 1 2 3 4 5 6 7 9 temp = 22580247