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.
Just wondering, but stack's don't have length, so it seems like using length violates the purpose of constricting yourself to using stacks. You could pop, then if is empty/peek, replace in stack. Seems like there should be a better way to do that, anyone have thoughts?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Queues: A Tale of Two Stacks
You are viewing a single comment's thread. Return to all comments →
Just wondering, but stack's don't have length, so it seems like using length violates the purpose of constricting yourself to using stacks. You could pop, then if is empty/peek, replace in stack. Seems like there should be a better way to do that, anyone have thoughts?