mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
修正了python版本的空间复杂度的描述
This commit is contained in:
@ -476,6 +476,7 @@ class Solution {
|
|||||||
## Python
|
## Python
|
||||||
|
|
||||||
> 递归法
|
> 递归法
|
||||||
|
> 常量空间,递归产生的栈不算
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Definition for a binary tree node.
|
# Definition for a binary tree node.
|
||||||
@ -521,7 +522,9 @@ class Solution:
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
> 迭代法-中序遍历-不使用额外空间,利用二叉搜索树特性
|
> 迭代法-中序遍历
|
||||||
|
> 利用二叉搜索树特性,在历遍过程中更新结果,一次历遍
|
||||||
|
> 但需要使用额外空间存储历遍的节点
|
||||||
```python
|
```python
|
||||||
class Solution:
|
class Solution:
|
||||||
def findMode(self, root: TreeNode) -> List[int]:
|
def findMode(self, root: TreeNode) -> List[int]:
|
||||||
|
Reference in New Issue
Block a user