You are viewing a single comment's thread. Return to all comments →
def equalStacks(h1, h2, h3):
s1 = sum(h1) s2 = sum(h2) s3 = sum(h3) while True: if s1 == s2 == s3: return(s1) m = max(s1, s2, s3) if len(h1) > 0 and s1 == m: a = h1.pop(0) s1-=a elif len(h2) > 0 and s2 == m: a = h2.pop(0) s2-=a elif len(h3) >0 and s3 == m: a = h3.pop(0) s3 -= a
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
def equalStacks(h1, h2, h3):