class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: res = [] n = len(nums) def helper(i, tmp): res.append(tmp) for j in range(i, n): helper(j + 1,tmp + [nums[j]] ) helper(0, []) return res 作者:powcai 链接:https://leetcode-cn.com/problems/subsets/solution/hui-su-suan-fa-by-powcai-5/ 来源:力扣(LeetCode) 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。