LeetCode 1. Two Sum

来源:互联网 发布:android滑动解锁源码 编辑:程序博客网 时间:2024/06/08 05:54
class Solution(object):    def twoSum(self, nums, target):        """        :type nums: List[int]        :type target: int        :rtype: List[int]        """        dict = {}        for ind, val in enumerate(nums):                        if target - val in dict:                return (dict[target - val], ind)            dict[val] = ind
原创粉丝点击