File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -262,8 +262,6 @@ class Solution:
262262# 中序遍历-迭代-LC94_二叉树的中序遍历
263263class Solution :
264264 def inorderTraversal (self , root : TreeNode) -> List[int ]:
265- if not root:
266- return []
267265 stack = [] # 不能提前将root结点加入stack中
268266 result = []
269267 cur = root
@@ -280,7 +278,7 @@ class Solution:
280278 cur = cur.right
281279 return result
282280```
283- ``` python
281+ ``` python
284282
285283# 后序遍历-迭代-LC145_二叉树的后序遍历
286284class Solution :
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ cd a/b/c/../../
107107设计单调队列的时候,pop,和push操作要保持如下规则:
108108
1091091 . pop(value):如果窗口移除的元素value等于单调队列的出口元素,那么队列弹出元素,否则不用任何操作
110- 2 . push(value):如果push的元素value大于入口元素的数值,那么就将队列出口的元素弹出 ,直到push元素的数值小于等于队列入口元素的数值为止
110+ 2 . push(value):如果push的元素value大于入口元素的数值,那么就将队列入口的元素弹出 ,直到push元素的数值小于等于队列入口元素的数值为止
111111
112112保持如上规则,每次窗口移动的时候,只要问que.front()就可以返回当前窗口的最大值。
113113
You can’t perform that action at this time.
0 commit comments