def subsets(S):
    S.sort()
    return [list(c) for i in range(len(S)+1) for c in comb(S, i)]
Beispiel #2
0
def combine(n, k):
    return map(list, comb(range(1, n + 1), k))
Beispiel #3
0
def comb2(num):
    for (i1,n1), (i2,n2) in comb(num, 2):
        yield i1+i2, n1+n2
Beispiel #4
0
def comb2(num):
    for (i1,n1), (i2,n2) in comb(num, 2):
        yield i1+i2, n1+n2
Beispiel #5
0
def subsetsWithDup(S):
    S.sort()
    return [list(c) for i in xrange(len(S) + 1) for c in comb(S, i)]
def combine(n, k):
    return map(list, comb(range(1,n+1), k))