You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constgetMaxAndMinArray=(a=[])=>{constl=a.length;if(l===0)return[];if(l==1){return[a[0],a[0]];}leti=0,j=l-1,max=-Infinity,min=Infinity;while(i<=j){if(a[i]<a[j]){max=max>a[j] ? max : a[j];min=min<a[i] ? min : a[i];}else{max=max>a[i] ? max : a[i];min=min<a[j] ? min : a[j];}i++;j--;}return[max,min];};
Activity
liwenkang commentedon May 12, 2019
cnyballk commentedon May 12, 2019