Queue using stack

wrong output

Dry run and check your deque function. It is not correct.
What you are doing is that-
Initially you are pushing every element on stack sp.
When you want a getFront operation, you are transferring every element to stack ss (Except the last elem).So now ss is empty. Now next time you again perform getFront operation, you are again trasferring elements from stack sp to ss. This is wrong.
Try to correct it.

@ayu2321 Please mark your doubt as resolved if it is so.

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.