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.
For each stack: pop items as long as its height is greater than the minimum height (when poping, take care of updating the stack height)
For each stack, when all excedentary elements are poped, check if the height is equal to the min height. If one stack is lower, go back to step 2. The algorithm is over when all stacks have the same height.
There should be less "all stacks have the same height" checking :)
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 →
You can refine that by:
There should be less "all stacks have the same height" checking :)