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.
Basically, we pop from the two taller stacks until their heights are less than or equal to the shortest stack. If their heights match, we return the height. Otherwise, we continue until any stack is empty, at which point we return 0.
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
Python 3 solution:
Basically, we pop from the two taller stacks until their heights are less than or equal to the shortest stack. If their heights match, we return the height. Otherwise, we continue until any stack is empty, at which point we return
0
.