Cody

# Problem 75. Find the palindrome

Solution 2045421

Submitted on 4 Dec 2019
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   Fail
a = 'xkayakyy'; p = 'kayak'; assert(isequal(p,pal(a)));

i= 1 maxj = 0 c = 0×0 empty char array i= 2 maxj = 1 j= 1 c = 0×0 empty char array i= 3 maxj = 2 j= 1 c = 0×0 empty char array i= 4 maxj = 4 i= 5 maxj = 3 i= 6 maxj = 2 i= 7 maxj = 1

Assertion failed.

2   Fail
a = '3.141592653589793238462643383279502884197169399375105820974944592307816406286'; p = '46264'; assert(isequal(p,pal(a)));

i= 1 maxj = 0 c = 0×0 empty char array i= 2 maxj = 1 j= 1 c = 0×0 empty char array i= 3 maxj = 2 j= 1 c = 0×0 empty char array i= 4 maxj = 3 j= 1 j= 2 c = '11' i= 5 maxj = 4 j= 1 c = '11' i= 6 maxj = 5 j= 1 c = '11' i= 7 maxj = 6 j= 1 c = '11' i= 8 maxj = 7 j= 1 c = '11' i= 9 maxj = 8 j= 1 c = '11' i= 10 maxj = 9 j= 1 c = '11' i= 11 maxj = 10 j= 1 j= 2 c = '5115' i= 12 maxj = 11 j= 1 c = '5115' i= 13 maxj = 12 j= 1 c = '5115' i= 14 maxj = 13 j= 1 c = '5115' i= 15 maxj = 14 j= 1 j= 2 c = '951159' i= 16 maxj = 15 j= 1 c = '951159' i= 17 maxj = 16 j= 1 c = '951159' i= 18 maxj = 17 j= 1 j= 2 c = '39511593' i= 19 maxj = 18 j= 1 c = '39511593' i= 20 maxj = 19 j= 1 c = '39511593' i= 21 maxj = 20 j= 1 c = '39511593' i= 22 maxj = 21 j= 1 c = '39511593' i= 23 maxj = 22 j= 1 j= 2 j= 3 c = '463951159364' i= 24 maxj = 23 j= 1 c = '463951159364' i= 25 maxj = 24 j= 1 c = '463951159364' i= 26 maxj = 25 j= 1 c = '463951159364' i= 27 maxj = 26 j= 1 c = '463951159364' i= 28 maxj = 27 j= 1 j= 2 c = '34639511593643' i= 29 maxj = 28 j= 1 c = '34639511593643' i= 30 maxj = 29 j= 1 c = '34639511593643' i= 31 maxj = 30 j= 1 c = '34639511593643' i= 32 maxj = 31 j= 1 c = '34639511593643' i= 33 maxj = 32 j= 1 c = '34639511593643' i= 34 maxj = 33 j= 1 c = '34639511593643' i= 35 maxj = 34 j= 1 c = '34639511593643' i= 36 maxj = 35 j= 1 c = '34639511593643' i= 37 maxj = 36 j= 1 c = '34639511593643' i= 38 i= 39 maxj = 38 i= 40 maxj = 37 i= 41 maxj = 36 i= 42 maxj = 35 i= 43 maxj = 34 i= 44 maxj = 33 i= 45 maxj = 32 i= 46 maxj = 31 i= 47 maxj = 30 i= 48 maxj = 29 i= 49 maxj = 28 i= 50 maxj = 27 i= 51 maxj = 26 i= 52 maxj = 25 i= 53 maxj = 24 i= 54 maxj = 23 i= 55 maxj = 22 i= 56 maxj = 21 i= 57 maxj = 20 i= 58 maxj = 19 i= 59 maxj = 18 i= 60 maxj = 17 i= 61 maxj = 16 i= 62 maxj = 15 i= 63 maxj = 14 i= 64 maxj = 13 i= 65 maxj = 12 i= 66 maxj = 11 i= 67 maxj = 10 i= 68 maxj = 9 i= 69 maxj = 8 i= 70 maxj = 7 i= 71 maxj = 6 i= 72 maxj = 5 i= 73 maxj = 4 i= 74 maxj = 3 i= 75 maxj = 2 i= 76 maxj = 1

Assertion failed.

3   Fail
a = 'truly I say: able was I ere I saw elba, but that is another story'; p = 'able was I ere I saw elba'; assert(isequal(p,pal(a)));

i= 1 maxj = 0 c = 0×0 empty char array i= 2 maxj = 1 j= 1 c = 0×0 empty char array i= 3 maxj = 2 j= 1 c = 0×0 empty char array i= 4 maxj = 3 j= 1 c = 0×0 empty char array i= 5 maxj = 4 j= 1 c = 0×0 empty char array i= 6 maxj = 5 j= 1 c = 0×0 empty char array i= 7 maxj = 6 j= 1 j= 2 c = ' ' i= 8 maxj = 7 j= 1 c = ' ' i= 9 maxj = 8 j= 1 c = ' ' i= 10 maxj = 9 j= 1 c = ' ' i= 11 maxj = 10 j= 1 c = ' ' i= 12 maxj = 11 j= 1 c = ' ' i= 13 maxj = 12 j= 1 c = ' ' i= 14 maxj = 13 j= 1 c = ' ' i= 15 maxj = 14 j= 1 c = ' ' i= 16 maxj = 15 j= 1 c = ' ' i= 17 maxj = 16 j= 1 c = ' ' i= 18 maxj = 17 j= 1 c = ' ' i= 19 maxj = 18 j= 1 c = ' ' i= 20 maxj = 19 j= 1 c = ' ' i= 21 maxj = 20 j= 1 c = ' ' i= 22 maxj = 21 j= 1 c = ' ' i= 23 maxj = 22 j= 1 j= 2 c = ' ' i= 24 maxj = 23 j= 1 c = ' ' i= 25 maxj = 24 j= 1 c = ' ' i= 26 maxj = 25 j= 1 j= 2 j= 3 j= 4 j= 5 j= 6 j= 7 j= 8 j= 9 j= 10 j= 11 j= 12 j= 13 c = 'able was I e e I saw elba' i= 27 maxj = 26 j= 1 c = 'able was I e e I saw elba' i= 28 maxj = 27 j= 1 c = 'able was I e e I saw elba' i= 29 maxj = 28 j= 1 j= 2 c = ' able was I e e I saw elba ' i= 30 maxj = 29 j= 1 c = ' able was I e e I saw elba ' i= 31 maxj = 30 j= 1 c = ' able was I e e I saw elba ' i= 32 i= 33 maxj = 32 i= 34 maxj = 31 i= 35 maxj = 30 i= 36 maxj = 29 i= 37 maxj = 28 i= 38 maxj = 27 i= 39 maxj = 26 i= 40 maxj = 25 i= 41 maxj = 24 i= 42 maxj = 23 i= 43 maxj = 22 i= 44 maxj = 21 i= 45 maxj = 20 i= 46 maxj = 19 i= 47 maxj = 18 i= 48 maxj = 17 i= 49 maxj = 16 i= 50 maxj = 15 i= 51 maxj = 14 i= 52 maxj = 13 i= 53 maxj = 12 i= 54 maxj = 11 i= 55 maxj = 10 i= 56 maxj = 9 i= 57 maxj = 8 i= 58 maxj = 7 i= 59 maxj = 6 i= 60 maxj = 5 i= 61 maxj = 4 i= 62 maxj = 3 i= 63 maxj = 2 i= 64 maxj = 1

Assertion failed.