You are viewing a single comment's thread. Return to all comments →
Did the same with set. But the counter idea is cool.
def equalStacks(h1, h2, h3): acc1 = list(accumulate(reversed(h1))) acc2 = list(accumulate(reversed(h2))) acc3 = list(accumulate(reversed(h3))) height = set(acc1) & set(acc2) & set(acc3) height = max(height) if bool(height) else 0 return height
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 →
Did the same with set. But the counter idea is cool.