Cody

# Haoyu Dai

Rank
##### 670
Score
1 – 50 of 96
 on 5 Jul 2020 Haoyu Dai submitted Solution 2653784 to Problem 76. De-dupe on 5 Jul 2020 Haoyu Dai submitted Solution 2653775 to Problem 76. De-dupe on 5 Jul 2020 Haoyu Dai submitted Solution 2653772 to Problem 76. De-dupe on 5 Jul 2020 on 5 Jul 2020 on 5 Jul 2020 on 5 Jul 2020 on 5 Jul 2020 Haoyu Dai submitted a Comment to Solution 2644234 function pmax = peakOfPeaks(nmax) pmax=1; tmp=[]; for i=1:nmax j=i; tmp=[tmp j]; while j~=1 if mod(j,2)==0 j=j/2; tmp=[tmp j]; else j=3*j+1; tmp=[tmp j]; end end if pmax0 a=x(1,:); cnt=zeros(1,c); for j=1:c for i=1:r if isempty(find(x(i,:)==x(1,j)))==0 cnt(j)=cnt(j)+1; end end end for j=1:c if cnt(j)==r&&x(1,j)~=NaN&&ismember(x(1,j),y)==0 y=[y x(1,j)]; end end y=sort(y); end end on 29 May 2020 on 29 May 2020 on 29 May 2020 Haoyu Dai submitted a Comment to Solution 2411043 function b = matchPattern(a) b=[]; len=length(a(1,:))-1; [r,c]=size(a); pattern=zeros(r-1,len); for j=1:r for i=1:len if a(j,i+1)>a(j,i) pattern(j,i)=1; elseif a(j,i+1)tmp tmp=m; i=j; end end end on 20 May 2020 Haoyu Dai submitted a Comment to Solution 2282642 function B = gameOfLife(A) B=A; C=[A,A,A;A,A,A;A,A,A]; for i=5:8 for j=5:8 cnt=0; for m=i-1:i+1 for n=j-1:j+1 if m==i&&n==j cnt=cnt; else if C(m,n)==1 cnt=cnt+1; end end end end if C(i,j)==1 %该细胞现在存活 if cnt>3||cnt<2 B(i-4,j-4)=0; end else %该细胞现在死亡 if cnt==3 B(i-4,j-4)=1; end end end end end on 15 May 2020 on 15 May 2020 on 15 May 2020 on 15 May 2020 Haoyu Dai submitted a Comment to Solution 2254132 function [r,c] = qwerty_coord(key) A={'1','2','3','4','5','6','7','8','9','0';'q','w','e','r','t','y','u','i','o','p'; 'a','s','d','f','g','h','j','k','l',':';'z','x','c','v','b','n','m','<','>','?'}; for i=1:4 for j=1:10 if A{i,j}==key; r=i; c=j; break; end end end end on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 Haoyu Dai submitted a Comment to Solution 2253868 function b = makingChange(a) cu=[10000,5000,2000,1000,500,200,100,50,25,10,5,1]; b=[]; m=a*100; for i=1:11 b(i)=floor(m/cu(i)); m=m-b(i)*cu(i); end b(12)=m; end on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 on 4 May 2020 Haoyu Dai submitted a Comment to Solution 2253288 function out_str = cellstr_joiner(in_cell, delim) c=in_cell; L=length(c); str=[]; for i=1:L if i~=L str=[str,c{1,i}]; str=[str,delim]; else str=[str,c{1,i}]; end end out_str=str; end on 4 May 2020 on 4 May 2020 on 3 May 2020 on 3 May 2020 on 3 May 2020 on 3 May 2020 Haoyu Dai submitted a Comment to Solution 2251477 function y = common_by_row(x) tmp=[]; y=[]; z=[]; k=1; [r,c]=size(x); for i=1:r for j=1:c if x(i,j)~=NaN if ismember(x(i,j),z)==0 z(k)=x(i,j); k=k+1; end end end end cnt=0; for k=1:length(z) for i=1:r for j=1:c if x(i,j)==z(k) cnt=cnt+1; end end end tmp(k)=cnt; cnt=0; end m=1; for i=1:length(z) if tmp(i)>0.5*r y(m)=z(i); m=m+1; end end y=sort(y); end on 3 May 2020 on 3 May 2020 on 3 May 2020 on 3 May 2020 on 3 May 2020
1 – 50 of 96