mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-10 14:36:06 +00:00
build
This commit is contained in:
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user