mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
Merge pull request #1850 from Undertone0809/patch-4
update 优化Python语法高亮显示
This commit is contained in:
@ -471,7 +471,7 @@ class Solution {
|
|||||||
### Python:
|
### Python:
|
||||||
|
|
||||||
双指针法
|
双指针法
|
||||||
```python3
|
```Python
|
||||||
class Solution:
|
class Solution:
|
||||||
def trap(self, height: List[int]) -> int:
|
def trap(self, height: List[int]) -> int:
|
||||||
res = 0
|
res = 0
|
||||||
@ -510,7 +510,7 @@ class Solution:
|
|||||||
return result
|
return result
|
||||||
```
|
```
|
||||||
单调栈
|
单调栈
|
||||||
```python3
|
```Python
|
||||||
class Solution:
|
class Solution:
|
||||||
def trap(self, height: List[int]) -> int:
|
def trap(self, height: List[int]) -> int:
|
||||||
# 单调栈
|
# 单调栈
|
||||||
|
@ -468,7 +468,7 @@ class Solution {
|
|||||||
---
|
---
|
||||||
## Python:
|
## Python:
|
||||||
递归法+隐形回溯
|
递归法+隐形回溯
|
||||||
```Python3
|
```Python
|
||||||
# Definition for a binary tree node.
|
# Definition for a binary tree node.
|
||||||
# class TreeNode:
|
# class TreeNode:
|
||||||
# def __init__(self, val=0, left=None, right=None):
|
# def __init__(self, val=0, left=None, right=None):
|
||||||
@ -499,7 +499,7 @@ class Solution:
|
|||||||
|
|
||||||
迭代法:
|
迭代法:
|
||||||
|
|
||||||
```python3
|
```Python
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ public class Solution {
|
|||||||
|
|
||||||
## Python
|
## Python
|
||||||
|
|
||||||
```Python3
|
```Python
|
||||||
class TreeNode:
|
class TreeNode:
|
||||||
def __init__(self, val = 0, left = None, right = None):
|
def __init__(self, val = 0, left = None, right = None):
|
||||||
self.val = val
|
self.val = val
|
||||||
|
Reference in New Issue
Block a user