Cody

Solution 2108740

Submitted on 28 Jan 2020
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))

a = 'amanaplanacanalpanama' b = 'amanaplanacanalpanama' y = logical 1

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

a = 'tacocat' b = 'tacocat' y = logical 1

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

a = 'amanaplancanalpanama' b = 'amanaplanacnalpanama' y = logical 0

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

a = '=g9Jyuev9yA7IvpROlTgwCCE1EjElQ_h:vNjNnJW?9`3<2p<gdCUsoEGQl12NJngIY6qsVGwQ[LCf8[xVcwZXT;GZnFsiPV7GN5cbVQ2WeDRe7XqN6oQBxXRpzA>hHVS??]tlOAi_RQPZrDA?h:K=fa\\OwfkB8qFyt3efgK2:H<vj\]g@4t\k\hUcjSBl3bETtZU@gp' b = 'pg@UZtTEb3lBSjcUh\k\t4@g]\jv<H:2Kgfe3tyFq8BkfwO\\af=K:h?ADrZPQR_iAOlt]??SVHh>AzpRXxBQo6NqX7eRDeW2QVbc5NG7VPisFnZG;TXZwcVx[8fCL[QwGVsq6YIgnJN21lQGEosUCdg<p2<3`9?WJnNjNv:h_QlEjE1ECCwgTlORpvI7Ay9veuyJ9g=' y = logical 0

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

a = 'WeY_laSoqfv29hYLtN8:[2Sx3[rcC[KfFAnHA1iJN7Z?cPAftB]6IGMjaN9LDxb\vjZn=V:^THmw@uZrWULR=E_tEcVmF^QturgR;?T2zC;1_dlYFLmJ;vRE]:gTo;MevZ[3TkKvw2j<ifaW5I\qJntVh?TBN5RavhTlZC?1RMFz:oStmfLPgqsjDrmsVhdOS^N]x1jhhj1x]N^SOdhVsmrDjsqgPLfmtSo:zFMR1?CZlThvaR5NBT?hVtnJq\I5Wafi<j2wvKkT3[ZveM;oTg:]ERv;JmLFYld_1;Cz2T?;RgrutQ^FmVcEt_E=RLUWrZu@wmHT^:V=nZjv\bxDL9NajMGI6]BtfAPc?Z7NJi1AHnAFfK[Ccr[3xS2[:8NtLYh92vfqoSal_YeW' b = 'WeY_laSoqfv29hYLtN8:[2Sx3[rcC[KfFAnHA1iJN7Z?cPAftB]6IGMjaN9LDxb\vjZn=V:^THmw@uZrWULR=E_tEcVmF^QturgR;?T2zC;1_dlYFLmJ;vRE]:gTo;MevZ[3TkKvw2j<ifaW5I\qJntVh?TBN5RavhTlZC?1RMFz:oStmfLPgqsjDrmsVhdOS^N]x1jhhj1x]N^SOdhVsmrDjsqgPLfmtSo:zFMR1?CZlThvaR5NBT?hVtnJq\I5Wafi<j2wvKkT3[ZveM;oTg:]ERv;JmLFYld_1;Cz2T?;RgrutQ^FmVcEt_E=RLUWrZu@wmHT^:V=nZjv\bxDL9NajMGI6]BtfAPc?Z7NJi1AHnAFfK[Ccr[3xS2[:8NtLYh92vfqoSal_YeW' y = logical 1

6   Fail
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) a=s(~isspace(s)) b=reverse(a) y=isequal(a,b) end ' a = 'functiony=is_pal(s)a=s(~isspace(s))b=reverse(a)y=isequal(a,b)end' b = 'dne)b,a(lauqesi=y)a(esrever=b))s(ecapssi~(s=a)s(lap_si=ynoitcnuf' y = logical 0

Assertion failed.

Suggested Problems

More from this Author7