第一期python版本:
class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
if not nums:
return None
d = {}
for i, item in enumerate(nums):
tmp = target - item
for key, value in d.items():
if value == tmp:
return [key, i]
d[i] = item
return None第二题
有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?