摘要: 1先利用符号栈转化为逆波兰表达式,并添加‘,’作为一个数字的结尾; 2然后利用数字栈计算逆波兰表达式的值; 阅读全文
posted @ 2019-06-12 22:39 Joel_Wang 阅读(361) 评论(0) 推荐(0) 编辑
摘要: time O(n) space O(1) 阅读全文
posted @ 2019-06-12 16:07 Joel_Wang 阅读(115) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: vector> dirs={{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1},{-1,0},{-1,1}}; void gameOfLife(vector>& board) { //time O(2*9*m*n) int r=board.size(); ... 阅读全文
posted @ 2019-06-12 11:22 Joel_Wang 阅读(243) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int maxArea(vector& height) { //双指针法:从最宽的容器开始计算,当更窄的容器盛水量要大于之前容器,那必须比之前容器高,因此可以移动两个指针,直到最窄time O(n),space O(1); int low=0; int high=height.size... 阅读全文
posted @ 2019-06-12 10:17 Joel_Wang 阅读(146) 评论(0) 推荐(0) 编辑