This commit is contained in:
krahets
2023-03-23 18:56:56 +08:00
parent 2715ce703a
commit 0dfdcf0bab
25 changed files with 118 additions and 115 deletions
@@ -65,7 +65,7 @@ comments: true
=== "Python"
```python title="leetcode_two_sum.py"
def two_sum_brute_force(nums: List[int], target: int) -> List[int]:
def two_sum_brute_force(nums: list[int], target: int) -> list[int]:
""" 方法一:暴力枚举 """
# 两层循环,时间复杂度 O(n^2)
for i in range(len(nums) - 1):
@@ -242,7 +242,7 @@ comments: true
=== "Python"
```python title="leetcode_two_sum.py"
def two_sum_hash_table(nums: List[int], target: int) -> List[int]:
def two_sum_hash_table(nums: list[int], target: int) -> list[int]:
""" 方法二:辅助哈希表 """
# 辅助哈希表,空间复杂度 O(n)
dic = {}