class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: subset = [] result = [] #i is index of subset def dfs(i): if i >= len(nums): result.append(subset.copy()) return #decision to include nums[i] subset.append(nums[i]) #this recursive call will be given filled subset dfs(i + 1) #decision NOT to include nums[i] subset.pop() #this recursive call will be given empty subset dfs(i + 1) dfs(0) return result