You are viewing a single comment's thread. Return to all comments →
def GrudyNumber(nodes): if(nodes == 0 or nodes == 2): return 0 else: return ((nodes-1)%2+1) def bobAndBen(trees): GrudyNumers= [] for i in range(len(trees)): GrudyNumers.append(GrudyNumber(trees[i][0])) re=GrudyNumers[0] print(GrudyNumers) if((len(GrudyNumers)-1)>1): for j in range(1,len(GrudyNumers)): re^=GrudyNumers[j] elif((len(GrudyNumers)-1)==1): re=re ^ GrudyNumers[1] if(re != 0): return 'BOB' else: return 'BEN'
Seems like cookies are disabled on this browser, please enable them to open this website
Bob and Ben
You are viewing a single comment's thread. Return to all comments →