Cody

Problem 1737. The sum of individual numbers...

Solution 2074806

Submitted on 30 Dec 2019 by Asif Newaz
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 = [1]; y = [1]; assert(isequal(individualNumSum(x),y))

a = 1 z = 1

2   Pass
x = [103]; y = [4]; assert(isequal(individualNumSum(x),y))

a = 103 y = 1 0 3 a = 4 z = 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))

a = 189 y = 1 8 9 a = 18 y = 1 8 a = 9 z = 9 a = 22 y = 2 2 a = 4 z = 9 4 a = 39 y = 3 9 a = 12 y = 1 2 a = 3 z = 9 4 3 a = 88 y = 8 8 a = 16 y = 1 6 a = 7 z = 9 4 3 7 a = 55 y = 5 5 a = 10 y = 1 0 a = 1 z = 9 4 3 7 1 a = 485 y = 4 8 5 a = 17 y = 1 7 a = 8 z = 9 4 3 7 1 8 a = 769 y = 7 6 9 a = 22 y = 2 2 a = 4 z = 9 4 3 7 1 8 4 a = 215 y = 2 1 5 a = 8 z = 9 4 3 7 1 8 4 8 a = 3685 y = 3 6 8 5 a = 22 y = 2 2 a = 4 z = 9 4 3 7 1 8 4 8 4 a = 4589 y = 4 5 8 9 a = 26 y = 2 6 a = 8 z = 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))

a = 1111 y = 1 1 1 1 a = 4 z = 4 a = 2222 y = 2 2 2 2 a = 8 z = 4 8 a = 3333 y = 3 3 3 3 a = 12 y = 1 2 a = 3 z = 4 8 3 a = 4444 y = 4 4 4 4 a = 16 y = 1 6 a = 7 z = 4 8 3 7 a = 5555 y = 5 5 5 5 a = 20 y = 2 0 a = 2 z = 4 8 3 7 2 a = 6666 y = 6 6 6 6 a = 24 y = 2 4 a = 6 z = 4 8 3 7 2 6 a = 7777 y = 7 7 7 7 a = 28 y = 2 8 a = 10 y = 1 0 a = 1 z = 4 8 3 7 2 6 1 a = 8888 y = 8 8 8 8 a = 32 y = 3 2 a = 5 z = 4 8 3 7 2 6 1 5 a = 9999 y = 9 9 9 9 a = 36 y = 3 6 a = 9 z = 4 8 3 7 2 6 1 5 9 a = 0 z = 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))

a = 111 y = 1 1 1 a = 3 z = 3 a = 222 y = 2 2 2 a = 6 z = 3 6 a = 333 y = 3 3 3 a = 9 z = 3 6 9 a = 444 y = 4 4 4 a = 12 y = 1 2 a = 3 z = 3 6 9 3 a = 555 y = 5 5 5 a = 15 y = 1 5 a = 6 z = 3 6 9 3 6 a = 666 y = 6 6 6 a = 18 y = 1 8 a = 9 z = 3 6 9 3 6 9 a = 777 y = 7 7 7 a = 21 y = 2 1 a = 3 z = 3 6 9 3 6 9 3 a = 888 y = 8 8 8 a = 24 y = 2 4 a = 6 z = 3 6 9 3 6 9 3 6 a = 999 y = 9 9 9 a = 27 y = 2 7 a = 9 z = 3 6 9 3 6 9 3 6 9 a = 0 z = 3 6 9 3 6 9 3 6 9 0

6   Pass
x=[11 3]; y = [2 3]; assert(isequal(individualNumSum(x),y))

a = 11 y = 1 1 a = 2 z = 2 a = 3 z = 2 3

Suggested Problems

More from this Author17