summaryrefslogtreecommitdiff
path: root/free-the-bunny-workers/solution.py
diff options
context:
space:
mode:
Diffstat (limited to 'free-the-bunny-workers/solution.py')
-rw-r--r--free-the-bunny-workers/solution.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/free-the-bunny-workers/solution.py b/free-the-bunny-workers/solution.py
new file mode 100644
index 0000000..66ca6e5
--- /dev/null
+++ b/free-the-bunny-workers/solution.py
@@ -0,0 +1,14 @@
+from itertools import combinations
+
+
+def solution(num_buns, num_required):
+ c = list(combinations(range(num_buns), num_buns - (num_required - 1)))
+ res = []
+
+ for bunny in range(num_buns):
+ res.append([k for k, b in enumerate(c) if bunny in b])
+
+ return res
+
+
+print(solution(5, 3))