You are viewing a single comment's thread. Return to all comments →
def pickingNumbers(l): t=[] for i in range(len(l)): for j in range(i+1,len(l)): a=[] a.append(l[i]) for z in range(j,len(l)): if(len(a)>1): m=a[0] n=a[1] if(m==n): if(l[z]==m+1): m=l[z] a[0]=m else: n=l[z] a[0]=n if((abs(l[i]-l[z])==0 or abs(l[i]-l[z])==1) and (l[z]==m or l[z]==n)): a.append(l[z]) else: if(abs(l[i]-l[z])==0 or abs(l[i]-l[z])==1): a.append(l[z]) t.append(len(a)) return(max(t))
Seems like cookies are disabled on this browser, please enable them to open this website
Picking Numbers
You are viewing a single comment's thread. Return to all comments →
python solution