• + 0 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