class MyStack {
LinkedList<Integer> list = new LinkedList<>();
public MyStack() {
}
public void push(int x) {
list.add(x);
}
public int pop() {
int val = list.getLast();
list.removeLast();
return val;
}
public int top() {
return list.getLast();
}
public boolean empty() {
return list.isEmpty();
}
}
标签:leetcode225,return,LinkedList,队列,list,public,int,实现
From: https://www.cnblogs.com/xzh-yyds/p/16625545.html