摘要:
150. 逆波兰表达式求值:基本stack 的操作 class Solution { public int evalRPN(String[] tokens) { Stack<Integer> stack = new Stack<>(); for(String s: tokens){ if("+".e 阅读全文
摘要:
栈:用stack 进栈(push), 出栈(pop) queue:用linkedList: offer(). poll() 232.用栈实现队列 class MyQueue { //用2个stack to implement the queue. //就是用第二个栈存数据。 //为什么不用把out的 阅读全文
摘要:
151.翻转字符串里的单词 class Solution { public String reverseWords(String s) { //// 删除首尾空格,分割字符串 String[] str = s.trim().split(" "); StringBuilder sb = new Str 阅读全文