Cody

Solution 1156866

Submitted on 8 Apr 2017 by H M Dipu Kabir
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
s = 'a man a plan a canal panama'; assert(isequal(is_pal(s),true))

y = logical 1

2   Pass
s = 'taco cat'; assert(isequal(is_pal(s),true))

y = logical 1

3   Pass
s = 'a man a plan canal panama'; assert(isequal(is_pal(s),false))

y = logical 0

4   Pass
s = char(randi(74,1,200)+'0'); assert(isequal(is_pal(s),false)); % most probably

y = logical 0

5   Pass
s = char(randi(74,1,200)+'0'); s = [s fliplr(s)]; assert(isequal(is_pal(s),true));

y = logical 1

6   Pass
s = fileread('is_pal.m'); s = regexprep(s,'%This code written by profile_id.*','') assert(isequal(is_pal(s),true));

s = 'function y = is_pal(s) i=1; while i<length(s) if strcmp(s(i),' ') s(i)=''; else i=i+1; end end y=strcmp(s, fliplr(s)) || strcmp('functiony',s(1:9)) end ' y = logical 1