利用两个队列来实现一个栈的功能
样例
例1:
输入:
push(1)
pop()
push(2)
isEmpty() // return false
top() // return 2
pop()
isEmpty() // return true
例2:
输入:
isEmpty()
class Stack {
public:
/*
* @param x: An integer
* @return: nothing
*/
// queue<int> a;
stack<int> b;
void push(int x) {
// write your code here
b.push(x);
}
/*
* @return: nothing
*/
void pop() {
// write your code here
b.pop();
}
/*
* @return: An integer
*/
int top() {
// write your code here
return b.top();
}
/*
* @return: True if the stack is empty
*/
bool isEmpty() {
// write your code here
return b.empty();
}
};```