1. 两数之和 class Solution(object): def twoSum(self, nums, target): ''' :type nums: List[int] :type target: int :rtype: List[int] ''' 使用类的时候需要进行初始化,否则会报错: TypeError: twoSum () missing 1 required positional argument: 'target' 只需要进行初始化即可 a = Solution()