Mental Model
A stack works like a pile where the last item added is the first removed. We can use a queue, which normally removes the first item added, to act like a stack by rearranging the order after each addition.
Analogy: Imagine a line of people (queue) where normally the first person in line is served first. To behave like a stack, after a new person joins at the end, we rotate the line so that this new person moves to the front, making them served first.
Queue before push: front -> [1] -> [2] -> [3] -> null After pushing 4 and rotating: front -> [4] -> [1] -> [2] -> [3] -> null
