๐Ÿ“ฆ schubart / LeetCode

๐Ÿ“„ lc_0001.py ยท 11 lines
1
2
3
4
5
6
7
8
9
10
11from typing import List


# noinspection PyMethodMayBeStatic,PyPep8Naming
class Solution:
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        for x in range(len(nums)):
            for y in range(x + 1, len(nums)):
                if nums[x] + nums[y] == target:
                    return [x, y]