Skip to content

Commit 4aea037

Browse files
authored
Update combinations with repetitions
1 parent a9cd9f9 commit 4aea037

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

combinations with repetitions

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ once, is called a combination of n objects taken r at a time with repetition.
88
# ans : (r+k -1)C(r)
99

1010

11+
1112
q = []
1213
a = np.arange(1,9) #types of doughnuts = k = 8
1314
l = a.tolist()
@@ -23,7 +24,7 @@ b = b.tolist()
2324
c = l + b #join both the lists
2425

2526

26-
c+d #--> this is a multiset, where since 12>8, 19-8 = 11 elements are
27+
c+d #--> this is a multiset, where since 12>8, here len(c+d) = r=k-1 = 19, since in the end we need to calculate 19C12
2728

2829
#duplicates of any of the 8 available
2930
p = list(combinations(c+d,r)) #diff 1 dozen combos of 8 doughnut varieties

0 commit comments

Comments
 (0)