摘要: class Solution { public int calculate(String s) { s = s.replace(" ", "")+'+'; //Add a '+' or '-' is necessary, otherwise, the case (1+1) will return 0 阅读全文
posted @ 2022-03-29 14:03 阳光明媚的菲越 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 这道题跟227题,背下来! Iterative: class Solution { public int calculate(String s) { s=s.replace(" ", "")+'+'; Stack<Integer> stk = new Stack<>(); int sign =1; 阅读全文
posted @ 2022-03-29 13:12 阳光明媚的菲越 阅读(21) 评论(0) 推荐(0) 编辑