LC 0077 [M] Combinations - ALawliet/algorithms GitHub Wiki
class Solution(object):
def combine(self, n, k):
res = []
def dfs(nums, k, path):
if len(path) == k:
res.append(path)
else:
for i in range(len(nums)):
dfs(nums[i+1:], k, path + [nums[i]])
dfs(range(1, n+1), k, [])
return res