Implementing Stack Using Queue
Too Long; Didn't Read
Sergei Golitsyn proposes a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (`push`,`top`),`pop` and `empty` The second variant is how we can solve the problem with a single queue. The last element in the queue will be the first element that was pushed to the top of the stack and the last one in a queue is the last element that has been pushed.