225. Implement Stack using Queues
# Easy
Three methods:
straight froward method: use queue 1 as main storage and queue 2 as helper. Use q2 when do
pop()
.smart method: use two queues, q1 stores all elements except top element, q2 only stores top element.
one queue method: only complicated when doing
push()
, change the order to the stack order.
Last updated