Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 394978

Submitted on 31 Jan 2014 by andrea84

Correct

36Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x = [1];
y = [1];
assert(isequal(individualNumSum(x),y))

                    
2
Pass
 
%%
x = [103];
y = [4];
assert(isequal(individualNumSum(x),y))
x =
     4
3
Pass
 
%%
x=[189 22 39 88 55 485 769 215 3685 4589];
y = [9 4 3 7 1 8 4 8 4 8];
assert(isequal(individualNumSum(x),y))
x =
  Columns 1 through 8
          18          22          39          88          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9          22          39          88          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4          39          88          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4          12          88          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3          88          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3          16          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7          55         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7          10         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1         485         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1          17         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1           8         769         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1           8          22         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1           8           4         215
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1           8           4           8
  Columns 9 through 10
        3685        4589
x =
  Columns 1 through 8
           9           4           3           7           1           8           4           8
  Columns 9 through 10
          22        4589
x =
  Columns 1 through 8
           9           4           3           7           1           8           4           8
  Columns 9 through 10
           4        4589
x =
     9     4     3     7     1     8     4     8     4    26
x =
     9     4     3     7     1     8     4     8     4     8
4
Pass
 
%%
x=[1111 2222 3333 4444 5555 6666 7777 8888 9999 0];
y = [4 8 3 7 2 6 1 5 9 0];
assert(isequal(individualNumSum(x),y))
x =
  Columns 1 through 8
           4        2222        3333        4444        5555        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8        3333        4444        5555        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8          12        4444        5555        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3        4444        5555        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3          16        5555        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7        5555        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7          20        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2        6666        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2          24        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2           6        7777        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2           6          28        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2           6          10        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2           6           1        8888
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2           6           1          32
  Columns 9 through 10
        9999           0
x =
  Columns 1 through 8
           4           8           3           7           2           6           1           5
  Columns 9 through 10
        9999           0
x =
     4     8     3     7     2     6     1     5    36     0
x =
     4     8     3     7     2     6     1     5     9     0
5
Pass
 
%%
x=[111 222 333 444 555 666 777 888 999 0];
y = [3 6 9 3 6 9 3 6 9 0];
assert(isequal(individualNumSum(x),y))
x =
     3   222   333   444   555   666   777   888   999     0
x =
     3     6   333   444   555   666   777   888   999     0
x =
     3     6     9   444   555   666   777   888   999     0
x =
     3     6     9    12   555   666   777   888   999     0
x =
     3     6     9     3   555   666   777   888   999     0
x =
     3     6     9     3    15   666   777   888   999     0
x =
     3     6     9     3     6   666   777   888   999     0
x =
     3     6     9     3     6    18   777   888   999     0
x =
     3     6     9     3     6     9   777   888   999     0
x =
     3     6     9     3     6     9    21   888   999     0
x =
     3     6     9     3     6     9     3   888   999     0
x =
     3     6     9     3     6     9     3    24   999     0
x =
     3     6     9     3     6     9     3     6   999     0
x =
     3     6     9     3     6     9     3     6    27     0
x =
     3     6     9     3     6     9     3     6     9     0
6
Pass
 
%%
x=[11 3];
y = [2 3];
assert(isequal(individualNumSum(x),y))
x =
     2     3