Cody

# Problem 75. Find the palindrome

Solution 1754527

Submitted on 19 Mar 2019 by Zain Faruqi
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
a = 'xkayakyy'; p = 'kayak'; assert(isequal(p,pal(a)));

s1 = 0×0 empty char array d = 0×0 empty char array o = 'k' o1 = 'k' s1 = 'k' lk = 1 m = 1 o = 'a' o1 = 'x' o = 'y' o1 = 'y' s1 = 'y' lk = 1 o = 'a' o1 = 'a' s1 = 'aya' lk = 3 m = 3 o = 'k' o1 = 'k' s1 = 'kayak' lk = 5 m = 5 o = 'y' o1 = 'x'

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

s1 = 0×0 empty char array d = 0×0 empty char array o = '.' o1 = '.' s1 = '.' lk = 1 m = 1 o = '1' o1 = '3' o = '4' o1 = '4' s1 = '4' lk = 1 o = '1' o1 = '1' s1 = '141' lk = 3 m = 3 o = '5' o1 = '.' o = '9' o1 = '9' s1 = '9' lk = 1 o = '2' o1 = '5' o = '6' o1 = '6' s1 = '6' lk = 1 o = '5' o1 = '2' o = '3' o1 = '3' s1 = '3' lk = 1 o = '5' o1 = '5' s1 = '535' lk = 3 o = '8' o1 = '6' o = '9' o1 = '9' s1 = '9' lk = 1 o = '7' o1 = '8' o = '9' o1 = '9' s1 = '9' lk = 1 o = '3' o1 = '7' o = '2' o1 = '2' s1 = '2' lk = 1 o = '3' o1 = '3' s1 = '323' lk = 3 o = '8' o1 = '9' o = '4' o1 = '4' s1 = '4' lk = 1 o = '6' o1 = '8' o = '2' o1 = '2' s1 = '2' lk = 1 o = '6' o1 = '6' s1 = '626' lk = 3 o = '4' o1 = '4' s1 = '46264' lk = 5 m = 5 o = '3' o1 = '8' o = '3' o1 = '3' s1 = '3' lk = 1 o = '8' o1 = '3' o = '3' o1 = '3' s1 = '3' lk = 1 o = '2' o1 = '8' o = '7' o1 = '7' s1 = '7' lk = 1 o = '9' o1 = '2' o = '5' o1 = '5' s1 = '5' lk = 1 o = '0' o1 = '9' o = '2' o1 = '2' s1 = '2' lk = 1 o = '8' o1 = '0' o = '8' o1 = '8' s1 = '8' lk = 1 o = '4' o1 = '8' o = '1' o1 = '1' s1 = '1' lk = 1 o = '9' o1 = '4' o = '7' o1 = '7' s1 = '7' lk = 1 o = '1' o1 = '9' o = '6' o1 = '6' s1 = '6' lk = 1 o = '9' o1 = '1' o = '3' o1 = '3' s1 = '3' lk = 1 o = '9' o1 = '9' s1 = '939' lk = 3 o = '9' o1 = '6' o = '3' o1 = '3' s1 = '3' lk = 1 o = '7' o1 = '9' o = '5' o1 = '5' s1 = '5' lk = 1 o = '1' o1 = '7' o = '0' o1 = '0' s1 = '0' lk = 1 o = '5' o1 = '1' o = '8' o1 = '8' s1 = '8' lk = 1 o = '2' o1 = '5' o = '0' o1 = '0' s1 = '0' lk = 1 o = '9' o1 = '2' o = '7' o1 = '7' s1 = '7' lk = 1 o = '4' o1 = '9' o = '9' o1 = '9' s1 = '9' lk = 1 o = '4' o1 = '4' s1 = '494' lk = 3 o = '4' o1 = '7' o = '5' o1 = '5' s1 = '5' lk = 1 o = '9' o1 = '4' o = '2' o1 = '2' s1 = '2' lk = 1 o = '3' o1 = '9' o = '0' o1 = '0' s1 = '0' lk = 1 o = '7' o1 = '3' o = '8' o1 = '8' s1 = '8' lk = 1 o = '1' o1 = '7' o = '6' o1 = '6' s1 = '6' lk = 1 o = '4' o1 = '1' o = '0' o1 = '0' s1 = '0' lk = 1 o = '6' o1 = '4' o = '2' o1 = '2' s1 = '2' lk = 1 o = '8' o1 = '6'

3   Pass
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)));

s1 = 0×0 empty char array d = 0×0 empty char array o = 'r' o1 = 'r' s1 = 'r' lk = 1 m = 1 o = 'u' o1 = 't' o = 'l' o1 = 'l' s1 = 'l' lk = 1 o = 'y' o1 = 'u' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 'I' o1 = 'y' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 's' o1 = 'I' o = 'a' o1 = 'a' s1 = 'a' lk = 1 o = 'y' o1 = 's' o = ':' o1 = ':' s1 = ':' lk = 1 o = ' ' o1 = 'y' o = 'a' o1 = 'a' s1 = 'a' lk = 1 o = 'b' o1 = ' ' o = 'l' o1 = 'l' s1 = 'l' lk = 1 o = 'e' o1 = 'b' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 'w' o1 = 'e' o = 'a' o1 = 'a' s1 = 'a' lk = 1 o = 's' o1 = 'w' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 'I' o1 = 's' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 'e' o1 = 'I' o = 'r' o1 = 'r' s1 = 'r' lk = 1 o = 'e' o1 = 'e' s1 = 'ere' lk = 3 m = 3 o = ' ' o1 = ' ' s1 = ' ere ' lk = 5 m = 5 o = 'I' o1 = 'I' s1 = 'I ere I' lk = 7 m = 7 o = ' ' o1 = ' ' s1 = ' I ere I ' lk = 9 m = 9 o = 's' o1 = 's' s1 = 's I ere I s' lk = 11 m = 11 o = 'a' o1 = 'a' s1 = 'as I ere I sa' lk = 13 m = 13 o = 'w' o1 = 'w' s1 = 'was I ere I saw' lk = 15 m = 15 o = ' ' o1 = ' ' s1 = ' was I ere I saw ' lk = 17 m = 17 o = 'e' o1 = 'e' s1 = 'e was I ere I saw e' lk = 19 m = 19 o = 'l' o1 = 'l' s1 = 'le was I ere I saw el' lk = 21 m = 21 o = 'b' o1 = 'b' s1 = 'ble was I ere I saw elb' lk = 23 m = 23 o = 'a' o1 = 'a' s1 = 'able was I ere I saw elba' lk = 25 m = 25 o = ',' o1 = ' ' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 'b' o1 = ',' o = 'u' o1 = 'u' s1 = 'u' lk = 1 o = 't' o1 = 'b' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 't' o1 = 't' s1 = 't t' lk = 3 o = 'h' o1 = 'u' o = 'a' o1 = 'a' s1 = 'a' lk = 1 o = 't' o1 = 'h' o = ' ' o1 = ' ' s1 = ' ' lk = 1 o = 'i' o1 = 't' o = 's' o1 = 's' s1 = 's' lk = 1 o = ' ' o1 = 'i' o = 'a' o1 = 'a' s1 = 'a' lk = 1 o = 'n' o1 = ' ' o = 'o' o1 = 'o' s1 = 'o' lk = 1 o = 't' o1 = 'n' o = 'h' o1 = 'h' s1 = 'h' lk = 1 o = 'e' o1 = 't' o = 'r' o1 = 'r' s1 = 'r' lk = 1 o = ' ' o1 = 'e' o = 's' o1 = 's' s1 = 's' lk = 1 o = 't' o1 = ' ' o = 'o' o1 = 'o' s1 = 'o' lk = 1 o = 'r' o1 = 't'