Cody

# Problem 75. Find the palindrome

Solution 1925716

Submitted on 8 Sep 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)));

a = 121 120 107 97 121 97 107 121 a = 121 121 120 107 97 121 97 107 a = 107 121 121 120 107 97 121 97 a = 97 107 121 121 120 107 97 121 a = 121 97 107 121 121 120 107 97 a = 97 121 97 107 121 121 120 107 a = 107 97 121 97 107 121 121 120 a = 120 107 97 121 97 107 121 121 s = 1×7 cell array {'yy'} {'ka'} {'ya'} {'aya'} {'ak'} {'yak'} {'ayak'}

Assertion failed.

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

a = Columns 1 through 29 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 50 54 52 51 51 56 Columns 30 through 58 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 48 53 56 50 48 57 Columns 59 through 77 55 52 57 52 52 53 57 50 51 48 55 56 49 54 52 48 54 50 56 a = Columns 1 through 29 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 50 54 52 51 51 Columns 30 through 58 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 48 53 56 50 48 Columns 59 through 77 57 55 52 57 52 52 53 57 50 51 48 55 56 49 54 52 48 54 50 a = Columns 1 through 29 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 50 54 52 51 Columns 30 through 58 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 48 53 56 50 Columns 59 through 77 48 57 55 52 57 52 52 53 57 50 51 48 55 56 49 54 52 48 54 a = Columns 1 through 29 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 50 54 52 Columns 30 through 58 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 48 53 56 Columns 59 through 77 50 48 57 55 52 57 52 52 53 57 50 51 48 55 56 49 54 52 48 a = Columns 1 through 29 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 50 54 Columns 30 through 58 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 48 53 Columns 59 through 77 56 50 48 57 55 52 57 52 52 53 57 50 51 48 55 56 49 54 52 a = Columns 1 through 29 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 50 Columns 30 through 58 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 48 Columns 59 through 77 53 56 50 48 57 55 52 57 52 52 53 57 50 51 48 55 56 49 54 a = Columns 1 through 29 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 54 Columns 30 through 58 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 49 Columns 59 through 77 48 53 56 50 48 57 55 52 57 52 52 53 57 50 51 48 55 56 49 a = Columns 1 through 29 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 52 Columns 30 through 58 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 53 Columns 59 through 77 49 48 53 56 50 48 57 55 52 57 52 52 53 57 50 51 48 55 56 a = Columns 1 through 29 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 56 Columns 30 through 58 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 55 Columns 59 through 77 53 49 48 53 56 50 48 57 55 52 57 52 52 53 57 50 51 48 55 a = Columns 1 through 29 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 51 Columns 30 through 58 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 51 Columns 59 through 77 55 53 49 48 53 56 50 48 57 55 52 57 52 52 53 57 50 51 48 a = Columns 1 through 29 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 50 Columns 30 through 58 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 57 Columns 59 through 77 51 55 53 49 48 53 56 50 48 57 55 52 57 52 52 53 57 50 51 a = Columns 1 through 29 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 51 Columns 30 through 58 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 57 Columns 59 through 77 57 51 55 53 49 48 53 56 50 48 57 55 52 57 52 52 53 57 50 a = Columns 1 through 29 50 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 57 Columns 30 through 58 51 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 51 Columns 59 through 77 57 57 51 55 53 49 48 53 56 50 48 57 55 52 57 52 52 53 57 a = Columns 1 through 29 57 50 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 55 Columns 30 through 58 57 51 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 57 Columns 59 through 77 51 57 57 51 55 53 49 48 53 56 50 48 57 55 52 57 52 52 53 a = Columns 1 through 29 53 57 50 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 57 Columns 30 through 58 55 57 51 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 54 Columns 59 through 77 57 51 57 57 51 55 53 49 48 53 56 50 48 57 55 52 57 52 52 a = Columns 1 through 29 52 53 57 50 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 56 Columns 30 through 58 57 55 57 51 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 49 Columns 59 through 77 54 57 51 57 57 51 55 53 49 48 53 56 50 48 57 55 52 57 52 a = Columns 1 through 29 52 52 53 57 50 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 53 Columns 30 through 58 56 57 55 57 51 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 55 Columns 59 through 77 49 54 57 51 57 57 51 55 53 49 48 53 56 50 48 57 55 52 57 a = Columns 1 through 29 57 52 52 53 57 50 51 48 55 56 49 54 52 48 54 50 56 54 51 46 49 52 49 53 57 50 54 53 51 Columns 30 through 58 53 56 57 55 57 51 50 51 56 52 54 50 54 52 51 51 56 51 50 55 57 53 48 50 56 56 52 49 57 Columns 59 through 77 55 49 54 57 51 57 57 51 55 53 49 48 53 56 50 48 57 55 52 a = Columns 1 through 29 52 57 52 52 53 57 50 51 48 55 56 49 54 52 48 54 50 5...

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

a = Columns 1 through 29 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 Columns 30 through 58 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 32 97 110 111 116 104 Columns 59 through 65 101 114 32 115 116 111 114 a = Columns 1 through 29 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 Columns 30 through 58 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 32 97 110 111 116 Columns 59 through 65 104 101 114 32 115 116 111 a = Columns 1 through 29 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 Columns 30 through 58 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 32 97 110 111 Columns 59 through 65 116 104 101 114 32 115 116 a = Columns 1 through 29 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 Columns 30 through 58 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 32 97 110 Columns 59 through 65 111 116 104 101 114 32 115 a = Columns 1 through 29 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 Columns 30 through 58 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 32 97 Columns 59 through 65 110 111 116 104 101 114 32 a = Columns 1 through 29 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 Columns 30 through 58 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 32 Columns 59 through 65 97 110 111 116 104 101 114 a = Columns 1 through 29 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 32 Columns 30 through 58 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 115 Columns 59 through 65 32 97 110 111 116 104 101 a = Columns 1 through 29 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 115 Columns 30 through 58 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 105 Columns 59 through 65 115 32 97 110 111 116 104 a = Columns 1 through 29 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 97 Columns 30 through 58 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 32 Columns 59 through 65 105 115 32 97 110 111 116 a = Columns 1 through 29 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 119 Columns 30 through 58 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 116 Columns 59 through 65 32 105 115 32 97 110 111 a = Columns 1 through 29 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 32 Columns 30 through 58 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 97 Columns 59 through 65 116 32 105 115 32 97 110 a = Columns 1 through 29 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 101 Columns 30 through 58 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 104 Columns 59 through 65 97 116 32 105 115 32 97 a = Columns 1 through 29 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 108 Columns 30 through 58 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 116 Columns 59 through 65 104 97 116 32 105 115 32 a = Columns 1 through 29 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 98 Columns 30 through 58 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 32 Columns 59 through 65 116 104 97 116 32 105 115 a = Columns 1 through 29 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 97 Columns 30 through 58 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 116 Columns 59 through 65 32 116 104 97 116 32 105 a = Columns 1 through 29 105 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 32 Columns 30 through 58 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 117 Columns 59 through 65 116 32 116 104 97 116 32 a = Columns 1 through 29 32 105 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 58 Columns 30 through 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 98 Columns 59 through 65 117 116 32 116 104 97 116 a = Columns 1 through 29 116 32 105 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 121 Columns 30 through 58 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 32 Columns 59 through 65 98 117 116 32 116 104 97 a = Columns 1 through 29 97 116 32 105 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 97 Columns 30 through 58 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 44 Columns 59 through 65 32 98 117 116 32 116 104 a = Columns 1 through 29 104 97 116 32 105 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 115 Columns 30 through 58 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 97 Columns 59 through 65 44 32 98 117 116 32 116 a = Columns 1 through 29 116 104 97 116 32 105 115 32 97 110 111 116 104 101 114 32 115 116 111 114 121 116 114 117 108 121 32 73 32 Columns 30 through 58 115 97 121 58 32 97 98 108 101 32 119 97 115 32 73 32 101 114 101 32 73 32 115 97 119 32 101 108 98 Columns 59 through 65 97 44 32 98 117 116 32 a = ...

Assertion failed.