반응형
전체 코드입니다.
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]
반응형
'Algorithm > LeetCode' 카테고리의 다른 글
[LeetCode][Python3] 98. Validate Binary Search Tree (0) | 2020.12.27 |
---|---|
[LeetCode][Python3] 17. Letter Combinations of a Phone Number (0) | 2020.12.27 |
[LeetCode][Python3] 21. Merge Two Sorted Lists (0) | 2020.12.26 |
[LeetCode][Python3] 20. Valid Parentheses (0) | 2020.12.26 |
[LeetCode][Python3] 14. Longest Common Prefix (0) | 2020.12.26 |