archive/Google FooBar/freeBunnies.py

11 lines
207 B
Python

from itertools import combinations
def solution(buns, reqs):
l = [ [] for x in range(buns) ]
c = combinations(range(buns), buns-reqs+1)
for i,t in enumerate(c):
for n in t: l[n].append(i)
return l