摘要:
cody challenge Problem 96. Knight's Tour Checker 代码分享 function tf = knights_tour(a) m=length(a(:,1)); n=length(a(1,:)); c=max(max(a)); tf=true; for b= 阅读全文
摘要:
Problem 30. Sort a list of complex numbers based on far they are from the origin. 仅用for循环实现代码 function zSort = complexSort(z) c=1; m=length(z)-1; n=1; 阅读全文
摘要:
1.自己的实现代码 function s2 = refcn(s1) s3='aeiouAEIOU'; m=0;n=1; for i=1:length(s1) for j=1:length(s3) s2(n)=s1(i); if s2(n)==s3(j) m=m+1; n=i-m; s2(n+1)=' 阅读全文
摘要:
1.自己的实现代码 function c = collatz(n) i=1; c(i)=n; if n==1 return; end for i=1:99 if mod(c(i),2) c(i+1)=3*c(i)+1; else c(i+1)=c(i)/2; end if c(i+1)==1 ret 阅读全文
摘要:
1.自己写的实现代码 function B = remove_nan_rows(A) a=[]; for i=1:length(A(:,1)) for j=1:length(A(1,:)) if isequal(0,A(i,j)) C(i,j)=A(i,j); else C(i,j)=0./A(i, 阅读全文