본문 바로가기

Algorithm/LeetCode

[LeetCode][Python3] 1.two-sum

반응형

github.com/dbwp031/LeetCode

 

dbwp031/LeetCode

my solution codes of problems from leetcode. Contribute to dbwp031/LeetCode development by creating an account on GitHub.

github.com

전체 코드입니다.

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

 

 

 

반응형