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 223102

Submitted on 25 Mar 2013

Incorrect

63Size
Leading solution size is 13.
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 = 'cody';
y_correct = [13 33 14 51];
assert(isequal(polybius(x),y_correct))
b =
    11    13    16     5
c =
     1     3     1     5
d =
     3     3     4     1
ans =
1  3  1  5
3  3  4  1
ans =
    13    33    14    51
2
Pass
 
%%
x = 'polybius';
y_correct = [34 33 26 51 12 23 43 41];
assert(isequal(polybius(x),y_correct))
b =
    18    13    27     5     6    12    14     4
c =
     3     3     2     5     1     2     4     4
d =
     4     3     6     1     2     3     3     1
ans =
3  3  2  5  1  2  4  4
4  3  6  1  2  3  3  1
ans =
    34    33    26    51    12    23    43    41
3
Fail
 
%%
x = 'i love matlab';
y_correct = [23 0 26 33 44 15 0 31 11 42 26 11 12];
assert(isequal(polybius(x),y_correct))
Error: Assertion failed.