摘要: 结果: [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]] 本质上是递归降维求解。 组合问题C(n, m)降维为C(n-1,m-1),而第一位可以: 选择1, 不选择1选择2, 不选择1不选择2选择3。。。。 if choose 1: xxx else: 阅读全文
posted @ 2018-04-05 19:07 bonelee 阅读(690) 评论(0) 推荐(0)
摘要: | 类循环排列 # tree DFS def loop_permutation(arr, depth, path, result): if depth == len(arr): result.append(list(path)) return for n in arr: path.append(n) 阅读全文
posted @ 2018-04-05 11:16 bonelee 阅读(788) 评论(0) 推荐(0)