leetcode two sum python
class Solution: # @param {integer[]} nums # @param {integer} target # @return {integer[]} def twoSum(self, nums, target): intLen=len(nums) if intLen <=1: return False res=[] dicts={} for i in range(0,intLen): if not dicts.has_key(target-nums[i]): dicts[nums[i]]=i else: tmpIndex=target-nums[i] res.append(dicts[tmpIndex]+1) res.append(i+1) return res