目录
参考:
题目描述:
Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (
push
,peek
,pop
, andempty
).Implement the
MyQueue
class:
void push(int x)
Pushes element x to the back of the queue.int pop()
Removes the elemen