python: leetcode - 1 Two Sum
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
value_container = {}
for index, value in enumerate(nums):
left_value = target - value
if value in value_container:
return [value_container[value], index]
value_container[left_value] = index
相關文章
- Leetcode 1 two sumLeetCode
- LeetCode | 1 Two SumLeetCode
- [LeetCode]1.Two SumLeetCode
- LeetCode----1. Two SumLeetCode
- LeetCode1:Two SumLeetCode
- [LeetCode]1. Two SumLeetCode
- LeetCode OJ : 1 Two SumLeetCode
- LeetCode-1 Two SumLeetCode
- LeetCode #1:Two Sum(簡單題)LeetCode
- [leetCode][012] Two Sum (1)LeetCode
- Leetcode-1 Two Sum(Java) -by zzyLeetCodeJava
- Leetcode Two SumLeetCode
- Leetcode-Two SumLeetCode
- Two Sum leetcode javaLeetCodeJava
- python leetcode 之兩數之和(two sum)PythonLeetCode
- 【LeetCode 1_陣列_雜湊表】Two SumLeetCode陣列
- LeetCode: Two sum(兩數之和)LeetCode
- LeetCode Problem-Sum of Two IntegersLeetCode
- [leetCode][013] Two Sum 2LeetCode
- [LeetCode] Two Sum 兩數之和LeetCode
- LeetCode-two sum:python解答陣列問題LeetCodePython陣列
- leetcode 371. Sum of Two IntegersLeetCode
- LeetCode Two Sum(001)解法總結LeetCode
- LeetCode-Two Sum III - Data structure designLeetCodeStruct
- 371. Sum of Two Integers--LeetCode RecordLeetCode
- 【Leetcode】167. Two Sum II - Input array is sortedLeetCode
- LeetCode 1.Two NumsLeetCode
- LeetCode 之 JavaScript 解答第一題 —— 兩數之和(Two Sum)LeetCodeJavaScript
- 力扣.1 兩數之和 N 種解法 two-sum力扣
- 653-Two Sum IV - Input is a BST
- JavaScript的two-sum問題解法JavaScript
- Leetcode Power of TwoLeetCode
- Leetcode Path SumLeetCode
- leetcode Sum系列LeetCode
- leetcode15&16_3Sum&4SumLeetCode
- Leetcode 3SumLeetCode
- Leetcode 4SumLeetCode
- Leetcode Path Sum IILeetCode