https://leetcode.com/problems/subsets/?envType=company&envId=tiktok&favoriteSlug=tiktok-three-months
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
self.paths=[]
def dfs(cur,path):
self.paths.append(path)
if cur==len(nums):return
for i in range(cur,len(nums)):
dfs(i+1,path+[nums[i]])
dfs(0,[])
return self.paths
注意最后一个item