You are viewing a single comment's thread. Return to all comments →
y = [] a.reverse() b.reverse() while True: if sum(y)< x: if a[-1]<b[-1]: y.append(a[-1]) a.pop() else: y.append(b[-1]) b.pop() else: break if sum(y)>x: y.pop() return(len(y))
y = [] a.reverse() b.reverse()
while True: if sum(y)< x:
if a[-1]<b[-1]: y.append(a[-1]) a.pop() else: y.append(b[-1]) b.pop() else: break
if sum(y)>x: y.pop() return(len(y))
Seems like cookies are disabled on this browser, please enable them to open this website
Game of Two Stacks
You are viewing a single comment's thread. Return to all comments →