+ 2
Just a question
How can we implement stack using two queue ? queue follows FIFO pattern . Even if we operate it using dequeue from front and insert it again in queue how will it make stack ? Stack produces LIFO and the last element of queue should be at the top of stack. Anyone explain pls here
4 Answers
+ 3
I have implemented it thanks for replying:)
+ 3
Ipang so as per your demand, i have made a code playground š
https://code.sololearn.com/c4jKOh5wfB75/?ref=app
+ 2
Davinder Kumar ,
not quite sure what you wanted to achieve. to give you helpful hints we need to get some more details.
> can you prepare input data and the expected output?
> please also mention the programming language you are going to use.
+ 2
Davinder Kumar
You can add that code in post Description for those people who may need it in the future š
It may be better to have "Implementation of stack using queue" in post title for easier search ...