Leetcode 题解 将所有的数两两比较,找到符合条件的两个数就返回下标。 代码 class Solution ( object ): def twoSum ( self , nums , target ): for i in range ( len ( nums )): for j in range ( i + 1 , len ( nums )): if nums [ i ] + nums [ j ] == target : return [ i , j ] 题解 递归求解 代码 class Solution ( object ): def addTwoNumbers ( self , l1 , l2 ): return self . res