mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-19 20:55:57 +08:00
Fix leetcode_two_sum.py
This commit is contained in:
@ -34,13 +34,13 @@ class SolutionHashMap:
|
|||||||
""" Driver Code """
|
""" Driver Code """
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# ======= Test Case =======
|
# ======= Test Case =======
|
||||||
nums = [ 2,7,11,15 ];
|
nums = [2,7,11,15]
|
||||||
target = 9;
|
target = 9
|
||||||
|
|
||||||
# ====== Driver Code ======
|
# ====== Driver Code ======
|
||||||
# 方法一
|
# 方法一
|
||||||
res = SolutionBruteForce().twoSum(nums, target);
|
res = SolutionBruteForce().twoSum(nums, target)
|
||||||
print("方法一 res =", res)
|
print("方法一 res =", res)
|
||||||
# 方法二
|
# 方法二
|
||||||
res = SolutionHashMap().twoSum(nums, target);
|
res = SolutionHashMap().twoSum(nums, target)
|
||||||
print("方法二 res =", res)
|
print("方法二 res =", res)
|
||||||
|
Reference in New Issue
Block a user