You are viewing a single comment's thread. Return to all comments →
def equalStacks(h1, h2, h3): stacks = [h1, h2, h3] heights = [sum(h1), sum(h2), sum(h3)] idx = [0, 0, 0] while not (heights[0] == heights[1] == heights[2]): i = heights.index(max(heights)) heights[i] -= stacks[i][idx[i]] idx[i] += 1 return heights[0]
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 →