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.
- Queues: A Tale of Two Stacks
- Discussions
Queues: A Tale of Two Stacks
Queues: A Tale of Two Stacks
Sort by
recency
|
422 Discussions
|
Please Login in order to post a comment
Python:
The question is to implement queue using two stacks, this doesn't use any stacks
Solution in PHP
javascript with customized Queue
JavaScript
With some of these challenges, I have no idea where to start and no idea how anyone else does either, like my brain isn't wired in the necessary way. I suspected this would be another example but on this occasion I'm baffled as to why this is a challenge at all. The simplistic solution below works for all test cases.
The problem description states you need to implmement the queue with two stacks. Here, you use one list, which is not according to the problem statement.