Please check this code i am trying to implement queue using two stack i am not getting the desired output
hello @anshulgurawalia
check now->
swapping of stack will flip the order so dont do that for example->
s1 -> {1,2} , s2-> {}
empty s1
s1->{} , s2-> {2,1}
now if u will swap then
s1 -> {2,1} ,s2->{} // see the order is different
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.