Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dfs(path, ars, combs):
- pos = len(path)
- if pos == len(ars):
- combs.append(path)
- return
- for x in ars[pos]:
- dfs(path+[x], ars, combs)
- def gen_combs(ars):
- combs = []
- dfs([], ars, combs)
- return combs
- ars = [[1, 2, 3], [10, 20]]
- print(gen_combs(ars))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement