Skip to content

Commit fbcc449

Browse files
solves itertools combinations
1 parent 5df7662 commit fbcc449

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

itertools/itertools-combinations.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://www.hackerrank.com/challenges/itertools-combinations/problem
2+
3+
import itertools
4+
5+
line = input().split()
6+
word = sorted(line[0])
7+
k = int(line[1])
8+
9+
for i in range(1, k + 1):
10+
for j in itertools.combinations(word, i):
11+
print(''.join(j))

0 commit comments

Comments
 (0)