You are viewing a single comment's thread. Return to all comments →
Python 3:
def equalStacks(h1, h2, h3): # Write your code here
h1 = h1[::-1] h2 = h2[::-1] h3 = h3[::-1] h1hite = sum(h1) h2hite = sum(h2) h3hite = sum(h3) while True: if h1hite == h2hite and h1hite == h3hite: break else: if h1hite >= h2hite and h1hite >= h3hite: x = h1.pop() h1hite -= x elif h2hite >= h1hite and h2hite >= h3hite: x = h2.pop() h2hite -= x elif h3hite >= h1hite and h3hite >= h2hite: x = h3.pop() h3hite -= x return h1hite
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 →
Python 3:
def equalStacks(h1, h2, h3): # Write your code here