Queue using two stacks

getting segmentation fault .


please correct the code.

Hello @Megha2468,

The logic you have used doesn’t satisfied the question.
It says dequeue efficient queue i.e.
the pop operation should take o(1) complexity.

But, this is not the case in your code.
I would suggest you watch this video.

After that see the following code that I have written:

Hope, this would help.
Give a like if you are satisfied.