what is wrong with my code->
Stack using 2 queue
this one only i send all the three times
alright wait checking…
why is that but in queue it works fine?thanks in advance
Say we have (1,2,3) () as stacks where Right end is top
so if we pop we will be doing this (1,2)(3) -> (1)(3,2) ->()(3,2) ->(2)(3)->(2,3)()
But right now when you are swapping you are doing this
(1,2)(3) -> (1)(3,2) ->()(3,2) ->(3,2)()
u see at end in swapping order of elements is reversed.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.