class Solution: def twoSum(self, nums, target): hashmap={} for i,j in enumerate(nums): res=target-j hashmap[j]=i if res in hashmap: return [hashmap[res],i]
欢迎分享,转载请注明来源:内存溢出
class Solution: def twoSum(self, nums, target): hashmap={} for i,j in enumerate(nums): res=target-j hashmap[j]=i if res in hashmap: return [hashmap[res],i]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)