摘要:
1先利用符号栈转化为逆波兰表达式,并添加‘,’作为一个数字的结尾; 2然后利用数字栈计算逆波兰表达式的值; 阅读全文
摘要:
time O(n) space O(1) 阅读全文
摘要:
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(); ... 阅读全文
摘要:
class Solution { public: int maxArea(vector& height) { //双指针法:从最宽的容器开始计算,当更窄的容器盛水量要大于之前容器,那必须比之前容器高,因此可以移动两个指针,直到最窄time O(n),space O(1); int low=0; int high=height.size... 阅读全文