We are given queue data structure, the task is to implement stack using only given queue data structure.
We have discussed a solution that uses two queues. In this article, a new solution is discussed that uses only one queue. This solution assumes that we can find size of queue at any point. The idea is to keep newly inserted element always at front of queue, keeping order of previous elements same. Below are complete steps.
Implement a Stack using Single Queue: https://www.geeksforgeeks.org/implement-a-stack-using-single-queue/