diff --git a/leetcode/1.py b/leetcode/1.py index f8bf37a..b646c56 100644 --- a/leetcode/1.py +++ b/leetcode/1.py @@ -5,7 +5,7 @@ class Solution: def twoSum(self, nums: list[int], target: int) -> list[int]: answer = [] - for i in range(len(nums) // 2 + 1): + for i in range(len(nums)): another = target - nums[i] # both number in the list @@ -22,9 +22,6 @@ class Solution: continue answer.append(i) answer.append(nums.index(another)) - print(nums) - print(another) - print(nums.index(another)) return answer return answer @@ -34,3 +31,8 @@ test = [3, 2, 4] TARGET_NUMBER = 6 a = Solution().twoSum(test, TARGET_NUMBER) print(a) + +test2 = [i for i in range(1, 10001)] +TARGET_NUMBER = 19999 +print(test2[9998], test2[9999]) +print(Solution().twoSum(test2, TARGET_NUMBER))