leetcode1-两数之和

思路: 1.使用暴力,两遍循环数组; 2.使用哈希表(字典),一遍循环即可。将数作为key,对应的索引作为value。注意a[b]!=i条件的限制 class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int
相关文章
相关标签/搜索