You are viewing a single comment's thread. Return to all comments →
Guys the point of this is to not rely too much on built-ins, so using collections.deque would likely not work in an interview.
That being said using stacks for this in Python seems to be too slow so the answer is don't implement Queues with two stacks in Python ;)
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 →
Guys the point of this is to not rely too much on built-ins, so using collections.deque would likely not work in an interview.
That being said using stacks for this in Python seems to be too slow so the answer is don't implement Queues with two stacks in Python ;)