How does this work?
This is precomputation, lookup table. Quite common method, when input variable is from small set(and computation long and hard). Now I think it is cheating in this competition, sorry:]
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
a = 1;
b = 2;
out = sumDigits(a);
assert(isequal(out, b))
|
2 | Pass |
%%
a = 10;
b = 7;
out = sumDigits(a);
assert(isequal(out, b))
|
3 | Pass |
%%
a = 16;
b = 25;
out = sumDigits(a);
assert(isequal(out, b))
|
401 Solvers
321 Solvers
358 Solvers
Matlab Basics - Convert a row vector to a column vector
419 Solvers
492 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!