We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
sums = [sum(h1), sum(h2), sum(h3)]
stacks = [h1, h2, h3]
t = min(sums)
while sums[0] != sums[1] or sums[1] != sums[2] or sums[0] != sums[2]:
for i in range(len(sums)):
while sums[i] > t:
sums[i] -= stacks[i].pop(0)
t = min(sums)
return t
Cookie support is required to access HackerRank
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):