It is also a reduce-and-conquer problem.

```
class Solution(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
def gen_subset(nums, begin, end):
if end-begin == 0: return [[]]
tmp = gen_subset(nums, begin+1, end) # exclude nums[0]
sets = tmp[:]
for x in tmp:
sets.append(x+[nums[begin]])
return sets
return gen_subset(nums, 0, len(nums))
```