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 138391

Submitted on 12 Sep 2012 by James

Correct

319Size
Leading solution size is 61.
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
 
%%
aStr = 'dan';
bStr = 'nan';
cStr = 'nora';
out = [921 121 1042];
assert(isequal(cryptoAdd(aStr,bStr,cStr),out))
list =
     0     1     2     3     4
     0     1     2     3     5
     0     1     2     3     6
     0     1     2     3     7
     0     1     2     3     8
     0     1     2     3     9
     0     1     2     4     5
     0     1     2     4     6
     0     1     2     4     7
     0     1     2     4     8
     0     1     2     4     9
     0     1     2     5     6
     0     1     2     5     7
     0     1     2     5     8
     0     1     2     5     9
     0     1     2     6     7
     0     1     2     6     8
     0     1     2     6     9
     0     1     2     7     8
     0     1     2     7     9
     0     1     2     8     9
     0     1     3     4     5
     0     1     3     4     6
     0     1     3     4     7
     0     1     3     4     8
     0     1     3     4     9
     0     1     3     5     6
     0     1     3     5     7
     0     1     3     5     8
     0     1     3     5     9
     0     1     3     6     7
     0     1     3     6     8
     0     1     3     6     9
     0     1     3     7     8
     0     1     3     7     9
     0     1     3     8     9
     0     1     4     5     6
     0     1     4     5     7
     0     1     4     5     8
     0     1     4     5     9
     0     1     4     6     7
     0     1     4     6     8
     0     1     4     6     9
     0     1     4     7     8
     0     1     4     7     9
     0     1     4     8     9
     0     1     5     6     7
     0     1     5     6     8
     0     1     5     6     9
     0     1     5     7     8
     0     1     5     7     9
     0     1     5     8     9
     0     1     6     7     8
     0     1     6     7     9
     0     1     6     8     9
     0     1     7     8     9
     0     2     3     4     5
     0     2     3     4     6
     0     2     3     4     7
     0     2     3     4     8
     0     2     3     4     9
     0     2     3     5     6
     0     2     3     5     7
     0     2     3     5     8
     0     2     3     5     9
     0     2     3     6     7
     0     2     3     6     8
     0     2     3     6     9
     0     2     3     7     8
     0     2     3     7     9
     0     2     3     8     9
     0     2     4     5     6
     0     2     4     5     7
     0     2     4     5     8
     0     2     4     5     9
     0     2     4     6     7
     0     2     4     6     8
     0     2     4     6     9
     0     2     4     7     8
     0     2     4     7     9
     0     2     4     8     9
     0     2     5     6     7
     0     2     5     6     8
     0     2     5     6     9
     0     2     5     7     8
     0     2     5     7     9
     0     2     5     8     9
     0     2     6     7     8
     0     2     6     7     9
     0     2     6     8     9
     0     2     7     8     9
     0     3     4     5     6
     0     3     4     5     7
     0     3     4     5     8
     0     3     4     5     9
     0     3     4     6     7
     0     3     4     6     8
     0     3     4     6     9
     0     3     4     7     8
     0     3     4     7     9
     0     3     4     8     9
     0     3     5     6     7
     0     3     5     6     8
     0     3     5     6     9
     0     3     5     7     8
     0     3     5     7     9
     0     3     5     8     9
     0     3     6     7     8
     0     3     6     7     9
     0     3     6     8     9
     0     3     7     8     9
     0     4     5     6     7
     0     4     5     6     8
     0     4     5     6     9
     0     4     5     7     8
     0     4     5     7     9
     0     4     5     8     9
     0     4     6     7     8
     0     4     6     7     9
     0     4     6     8     9
     0     4     7     8     9
     0     5     6     7     8
     0     5     6     7     9
     0     5     6     8     9
     0     5     7     8     9
     0     6     7     8     9
     1     2     3     4     5
     1     2     3     4     6
     1     2     3     4     7
     1     2     3     4     8
     1     2     3     4     9
     1     2     3     5     6
     1     2     3     5     7
     1     2     3     5     8
     1     2     3     5     9
     1     2     3     6     7
     1     2     3     6     8
     1     2     3     6     9
     1     2     3     7     8
     1     2     3     7     9
     1     2     3     8     9
     1     2     4     5     6
     1     2     4     5     7
     1     2     4     5     8
     1     2     4     5     9
     1     2     4     6     7
     1     2     4     6     8
     1     2     4     6     9
     1     2     4     7     8
     1     2     4     7     9
     1     2     4     8     9
     1     2     5     6     7
     1     2     5     6     8
     1     2     5     6     9
     1     2     5     7     8
     1     2     5     7     9
     1     2     5     8     9
     1     2     6     7     8
     1     2     6     7     9
     1     2     6     8     9
     1     2     7     8     9
     1     3     4     5     6
     1     3     4     5     7
     1     3     4     5     8
     1     3     4     5     9
     1     3     4     6     7
     1     3     4     6     8
     1     3     4     6     9
     1     3     4     7     8
     1     3     4     7     9
     1     3     4     8     9
     1     3     5     6     7
     1     3     5     6     8
     1     3     5     6     9
     1     3     5     7     8
     1     3     5     7     9
     1     3     5     8     9
     1     3     6     7     8
     1     3     6     7     9
     1     3     6     8     9
     1     3     7     8     9
     1     4     5     6     7
     1     4     5     6     8
     1     4     5     6     9
     1     4     5     7     8
     1     4     5     7     9
     1     4     5     8     9
     1     4     6     7     8
     1     4     6     7     9
     1     4     6     8     9
     1     4     7     8     9
     1     5     6     7     8
     1     5     6     7     9
     1     5     6     8     9
     1     5     7     8     9
     1     6     7     8     9
     2     3     4     5     6
     2     3     4     5     7
     2     3     4     5     8
     2     3     4     5     9
     2     3     4     6     7
     2     3     4     6     8
     2     3     4     6     9
     2     3     4     7     8
     2     3     4     7     9
     2     3     4     8     9
     2     3     5     6     7
     2     3     5     6     8
     2     3     5     6     9
     2     3     5     7     8
     2     3     5     7     9
     2     3     5     8     9
     2     3     6     7     8
     2     3     6     7     9
     2     3     6     8     9
     2     3     7     8     9
     2     4     5     6     7
     2     4     5     6     8
     2     4     5     6     9
     2     4     5     7     8
     2     4     5     7     9
     2     4     5     8     9
     2     4     6     7     8
     2     4     6     7     9
     2     4     6     8     9
     2     4     7     8     9
     2     5     6     7     8
     2     5     6     7     9
     2     5     6     8     9
     2     5     7     8     9
     2     6     7     8     9
     3     4     5     6     7
     3     4     5     6     8
     3     4     5     6     9
     3     4     5     7     8
     3     4     5     7     9
     3     4     5     8     9
     3     4     6     7     8
     3     4     6     7     9
     3     4     6     8     9
     3     4     7     8     9
     3     5     6     7     8
     3     5     6     7     9
     3     5     6     8     9
     3     5     7     8     9
     3     6     7     8     9
     4     5     6     7     8
     4     5     6     7     9
     4     5     6     8     9
     4     5     7     8     9
     4     6     7     8     9
     5     6     7     8     9
out =
         921         121        1042
2
Pass
 
%%
aStr = 'wait';
bStr = 'all';
cStr = 'gifts';
out = [9608 677 10285];
assert(isequal(cryptoAdd(aStr,bStr,cStr),out))
list =
     0     1     2     3     4     5     6     7
     0     1     2     3     4     5     6     8
     0     1     2     3     4     5     6     9
     0     1     2     3     4     5     7     8
     0     1     2     3     4     5     7     9
     0     1     2     3     4     5     8     9
     0     1     2     3     4     6     7     8
     0     1     2     3     4     6     7     9
     0     1     2     3     4     6     8     9
     0     1     2     3     4     7     8     9
     0     1     2     3     5     6     7     8
     0     1     2     3     5     6     7     9
     0     1     2     3     5     6     8     9
     0     1     2     3     5     7     8     9
     0     1     2     3     6     7     8     9
     0     1     2     4     5     6     7     8
     0     1     2     4     5     6     7     9
     0     1     2     4     5     6     8     9
     0     1     2     4     5     7     8     9
     0     1     2     4     6     7     8     9
     0     1     2     5     6     7     8     9
     0     1     3     4     5     6     7     8
     0     1     3     4     5     6     7     9
     0     1     3     4     5     6     8     9
     0     1     3     4     5     7     8     9
     0     1     3     4     6     7     8     9
     0     1     3     5     6     7     8     9
     0     1     4     5     6     7     8     9
     0     2     3     4     5     6     7     8
     0     2     3     4     5     6     7     9
     0     2     3     4     5     6     8     9
     0     2     3     4     5     7     8     9
     0     2     3     4     6     7     8     9
     0     2     3     5     6     7     8     9
     0     2     4     5     6     7     8     9
     0     3     4     5     6     7     8     9
     1     2     3     4     5     6     7     8
     1     2     3     4     5     6     7     9
     1     2     3     4     5     6     8     9
     1     2     3     4     5     7     8     9
     1     2     3     4     6     7     8     9
     1     2     3     5     6     7     8     9
     1     2     4     5     6     7     8     9
     1     3     4     5     6     7     8     9
     2     3     4     5     6     7     8     9
out =
        9608         677       10285
3
Pass
 
%%
aStr = 'memo';
bStr = 'from';
cStr = 'homer';
out = [8485 7358 15843];
assert(isequal(cryptoAdd(aStr,bStr,cStr),out))
list =
     0     1     2     3     4     5
     0     1     2     3     4     6
     0     1     2     3     4     7
     0     1     2     3     4     8
     0     1     2     3     4     9
     0     1     2     3     5     6
     0     1     2     3     5     7
     0     1     2     3     5     8
     0     1     2     3     5     9
     0     1     2     3     6     7
     0     1     2     3     6     8
     0     1     2     3     6     9
     0     1     2     3     7     8
     0     1     2     3     7     9
     0     1     2     3     8     9
     0     1     2     4     5     6
     0     1     2     4     5     7
     0     1     2     4     5     8
     0     1     2     4     5     9
     0     1     2     4     6     7
     0     1     2     4     6     8
     0     1     2     4     6     9
     0     1     2     4     7     8
     0     1     2     4     7     9
     0     1     2     4     8     9
     0     1     2     5     6     7
     0     1     2     5     6     8
     0     1     2     5     6     9
     0     1     2     5     7     8
     0     1     2     5     7     9
     0     1     2     5     8     9
     0     1     2     6     7     8
     0     1     2     6     7     9
     0     1     2     6     8     9
     0     1     2     7     8     9
     0     1     3     4     5     6
     0     1     3     4     5     7
     0     1     3     4     5     8
     0     1     3     4     5     9
     0     1     3     4     6     7
     0     1     3     4     6     8
     0     1     3     4     6     9
     0     1     3     4     7     8
     0     1     3     4     7     9
     0     1     3     4     8     9
     0     1     3     5     6     7
     0     1     3     5     6     8
     0     1     3     5     6     9
     0     1     3     5     7     8
     0     1     3     5     7     9
     0     1     3     5     8     9
     0     1     3     6     7     8
     0     1     3     6     7     9
     0     1     3     6     8     9
     0     1     3     7     8     9
     0     1     4     5     6     7
     0     1     4     5     6     8
     0     1     4     5     6     9
     0     1     4     5     7     8
     0     1     4     5     7     9
     0     1     4     5     8     9
     0     1     4     6     7     8
     0     1     4     6     7     9
     0     1     4     6     8     9
     0     1     4     7     8     9
     0     1     5     6     7     8
     0     1     5     6     7     9
     0     1     5     6     8     9
     0     1     5     7     8     9
     0     1     6     7     8     9
     0     2     3     4     5     6
     0     2     3     4     5     7
     0     2     3     4     5     8
     0     2     3     4     5     9
     0     2     3     4     6     7
     0     2     3     4     6     8
     0     2     3     4     6     9
     0     2     3     4     7     8
     0     2     3     4     7     9
     0     2     3     4     8     9
     0     2     3     5     6     7
     0     2     3     5     6     8
     0     2     3     5     6     9
     0     2     3     5     7     8
     0     2     3     5     7     9
     0     2     3     5     8     9
     0     2     3     6     7     8
     0     2     3     6     7     9
     0     2     3     6     8     9
     0     2     3     7     8     9
     0     2     4     5     6     7
     0     2     4     5     6     8
     0     2     4     5     6     9
     0     2     4     5     7     8
     0     2     4     5     7     9
     0     2     4     5     8     9
     0     2     4     6     7     8
     0     2     4     6     7     9
     0     2     4     6     8     9
     0     2     4     7     8     9
     0     2     5     6     7     8
     0     2     5     6     7     9
     0     2     5     6     8     9
     0     2     5     7     8     9
     0     2     6     7     8     9
     0     3     4     5     6     7
     0     3     4     5     6     8
     0     3     4     5     6     9
     0     3     4     5     7     8
     0     3     4     5     7     9
     0     3     4     5     8     9
     0     3     4     6     7     8
     0     3     4     6     7     9
     0     3     4     6     8     9
     0     3     4     7     8     9
     0     3     5     6     7     8
     0     3     5     6     7     9
     0     3     5     6     8     9
     0     3     5     7     8     9
     0     3     6     7     8     9
     0     4     5     6     7     8
     0     4     5     6     7     9
     0     4     5     6     8     9
     0     4     5     7     8     9
     0     4     6     7     8     9
     0     5     6     7     8     9
     1     2     3     4     5     6
     1     2     3     4     5     7
     1     2     3     4     5     8
     1     2     3     4     5     9
     1     2     3     4     6     7
     1     2     3     4     6     8
     1     2     3     4     6     9
     1     2     3     4     7     8
     1     2     3     4     7     9
     1     2     3     4     8     9
     1     2     3     5     6     7
     1     2     3     5     6     8
     1     2     3     5     6     9
     1     2     3     5     7     8
     1     2     3     5     7     9
     1     2     3     5     8     9
     1     2     3     6     7     8
     1     2     3     6     7     9
     1     2     3     6     8     9
     1     2     3     7     8     9
     1     2     4     5     6     7
     1     2     4     5     6     8
     1     2     4     5     6     9
     1     2     4     5     7     8
     1     2     4     5     7     9
     1     2     4     5     8     9
     1     2     4     6     7     8
     1     2     4     6     7     9
     1     2     4     6     8     9
     1     2     4     7     8     9
     1     2     5     6     7     8
     1     2     5     6     7     9
     1     2     5     6     8     9
     1     2     5     7     8     9
     1     2     6     7     8     9
     1     3     4     5     6     7
     1     3     4     5     6     8
     1     3     4     5     6     9
     1     3     4     5     7     8
     1     3     4     5     7     9
     1     3     4     5     8     9
     1     3     4     6     7     8
     1     3     4     6     7     9
     1     3     4     6     8     9
     1     3     4     7     8     9
     1     3     5     6     7     8
     1     3     5     6     7     9
     1     3     5     6     8     9
     1     3     5     7     8     9
     1     3     6     7     8     9
     1     4     5     6     7     8
     1     4     5     6     7     9
     1     4     5     6     8     9
     1     4     5     7     8     9
     1     4     6     7     8     9
     1     5     6     7     8     9
     2     3     4     5     6     7
     2     3     4     5     6     8
     2     3     4     5     6     9
     2     3     4     5     7     8
     2     3     4     5     7     9
     2     3     4     5     8     9
     2     3     4     6     7     8
     2     3     4     6     7     9
     2     3     4     6     8     9
     2     3     4     7     8     9
     2     3     5     6     7     8
     2     3     5     6     7     9
     2     3     5     6     8     9
     2     3     5     7     8     9
     2     3     6     7     8     9
     2     4     5     6     7     8
     2     4     5     6     7     9
     2     4     5     6     8     9
     2     4     5     7     8     9
     2     4     6     7     8     9
     2     5     6     7     8     9
     3     4     5     6     7     8
     3     4     5     6     7     9
     3     4     5     6     8     9
     3     4     5     7     8     9
     3     4     6     7     8     9
     3     5     6     7     8     9
     4     5     6     7     8     9
out =
        8485        7358       15843
4
Pass
 
%%
%aStr = 'coca';
%bStr = 'cola';
%cStr = 'oasis';
%out = [8186 8106 16292];
%assert(isequal(cryptoAdd(aStr,bStr,cStr),out))