Update worst_best_time_complexity,

leetcode_two_sum
This commit is contained in:
Yudong Jin
2023-02-03 18:53:15 +08:00
parent 592965595e
commit 70dead5cd0
24 changed files with 63 additions and 121 deletions

View File

@ -8,6 +8,7 @@ import sys, os.path as osp
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from include import *
""" 方法一:暴力枚举 """
class SolutionBruteForce:
def twoSum(self, nums: List[int], target: int) -> List[int]:
for i in range(len(nums) - 1):
@ -16,6 +17,7 @@ class SolutionBruteForce:
return i, j
return []
""" 方法二:辅助哈希表 """
class SolutionHashMap:
def twoSum(self, nums: List[int], target: int) -> List[int]:
dic = {}