hi, my cod gives me true ans but its worked too slow because of for loop but could not figure it out without for loop. could u send me our code or check mines ? function u = euler004(n)
function L = ispalindrome(n)
s=num2str(n);
l=length(s);
for i=1:ceil(l/2)
if str2double(s(i)) == str2double(s(l-i+1))
continue
else
L=false;
return
end
end
L=true;
end
c=numel(num2str(n));
switch c
case 3
l=9;
case 4
l=99;
end
g=l:n;
m=l:n;
z=g'*m;
b=z(:)';
T=[];
for vz=1:numel(b)
if ispalindrome(b(vz))>0
T=b(vz);
end
end
u=max(T);
end
Hi sir, could u share ur solution with me cause I attempt nearly 50 times and still ain't got to complate. I don't know where is the problem and it's frustrating.