Skip to content

Update 001_Two_Sum.py #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update 001_Two_Sum.py
  • Loading branch information
backendbuilderdev authored Aug 18, 2023
commit d154feebf5e93013b4a55fb6272fb3e884420cc0
11 changes: 0 additions & 11 deletions 001_Two_Sum.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
# nums_index = list(enumerate(nums))
# nums_index.sort()
# print(nums)
for i in range(len(nums)):
complement = target-nums[i]
if complement in nums and nums.index(complement) != i:
return [i,nums.index(complement)]
# for i in range(len(nums)-1):
# j=i+1
# while j < len(nums):
# if nums[i]+nums[j]==target:
# return [i, j]
# j += 1
# i += 1
# return result