def subsets(nums):
def backtrack(res, nums, stack, pos):<EOL><INDENT>if pos == len(nums):<EOL><INDENT>res.append(list(stack))<EOL><DEDENT>else:<EOL><INDENT>stack.append(nums[pos])<EOL>backtrack(res, nums, stack, pos+<NUM_LIT:1>)<EOL>stack.pop()<EOL>backtrack(res, nums, stack, pos+<NUM_LIT:1>)<EOL><DEDENT><DEDENT>res = []<EOL>backtrack(res, nums, [], <NUM_LIT:0>)<EOL>return res<EOL>
O(2**n)