xxt 11 months ago
parent
commit
02e0e24153
1 changed files with 7 additions and 0 deletions
  1. 7 0
      twoSum.py

+ 7 - 0
twoSum.py

@@ -0,0 +1,7 @@
+class Solution:
+    def twoSum(self, nums: List[int], target: int) -> List[int]:
+        n = len(nums)
+        for i in range(n):
+            for j in range(i + 1 , n):
+                if nums[i] + nums[j] == target:
+                    return [i , j]