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.
My original solution was doing a copy every time a dequeue happened, resulting in some tests timing out.
Your solution is a step above and optimizes the copy step. Thanks!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Queue using Two Stacks
You are viewing a single comment's thread. Return to all comments →
My original solution was doing a copy every time a dequeue happened, resulting in some tests timing out. Your solution is a step above and optimizes the copy step. Thanks!