Cody

Haoyu Dai

2653
Rank
3
Badges
670
Score
51 – 96 of 96

Haoyu Dai submitted a Comment to Solution 2249828

function tf = isPangram(s) s1='QWERTYUIOPASDFGHJKLZXCVBNM'; L=strlength(s); cnt=0; s2=upper(s); for i=1:26 if isempty(findstr(s1(i),s2))==false cnt=cnt+1; continue; end end if cnt==26 tf=true; else tf=false; end end

on 2 May 2020

Haoyu Dai submitted Solution 2249828 to Problem 27. Pangrams!

on 2 May 2020

Haoyu Dai submitted a Comment to Solution 2247535

function b = isItSquared(a) b = false; L=length(a); for i=1:L c=a(i)^2; for j=1:L if c==a(j) b=true; break; end end end end

on 1 May 2020

Haoyu Dai submitted a Comment to Solution 2246344

function s2 = refcn(s1) s2 = []; s3='aAeEiIoOuU'; L=strlength(s1); L1=strlength(s3); flag=0; j=1; for i=1:L for k=1:L1 if s1(i)==s3(k) flag=1; continue; end end if flag==0 s2(j)=s1(i); j=j+1; end flag=0; end end

on 30 Apr 2020

Haoyu Dai submitted a Comment to Solution 2245785

function b = sumDigits(n) pow=2^n; b = 0; while pow~=0 b=b+mod(pow,10); pow=floor(pow/10); end end

on 30 Apr 2020

Haoyu Dai submitted a Comment to Solution 2245600

function B = swap_ends(A) B=A; [r,c]=size(A); B(:,1)=A(:,c); B(:,c)=A(:,1); end

on 30 Apr 2020

Haoyu Dai submitted a Comment to Solution 2245278

function y = cleanUp(x) y = x; L=length(y); for i=1:L if (y(i)<0)|(y(i)>10) y(i)=NaN; end end end

on 30 Apr 2020

Haoyu Dai submitted a Comment to Solution 2245266

function y = nearZero(x) y = []; a=[]; k=1; L=length(x); for i=1:L if x(i)==0 if i==1 a(k)=x(i+1); k=k+1; elseif i==L a(k)=x(i-1); k=k+1; else a(k)=x(i-1); a(k+1)=x(i+1); k=k+2; end end end [y,index]=max(a); end

on 30 Apr 2020

Haoyu Dai submitted a Comment to Solution 2245236

function y = lengthOnes(x) cnt=0; a=[]; L=strlength(x); for i=1:L if x(i)=='1' cnt=cnt+1; else cnt=0; end a(i)=cnt; end [y,index]=max(a); end

on 30 Apr 2020

Haoyu Dai received Promoter badge for Problem 13. Remove all the consonants

on 30 Apr 2020

Haoyu Dai submitted a Comment to Problem 13. Remove all the consonants

function s2 = refcn(s1) s2=''; k=1; flag=0; L=strlength(s1); s3='BbCcDdFfGgHhJjKkLlMmNnPpQqRrSsTtVvWwXxYyZz'; L1=strlength(s3); for i=1:L for j=1:L1 if s1(i)==s3(j) flag=1; continue; end end if flag==0 s2(k)=s1(i); k=k+1; end flag=0; end end

on 30 Apr 2020

Haoyu Dai received Commenter badge for Problem 13. Remove all the consonants

on 30 Apr 2020

Haoyu Dai received Solver badge for Solution 2238048

on 27 Apr 2020

51 – 96 of 96