hackerearth1

Solutions on MaxInterview for hackerearth1 by the best coders in the world

showing results for - "hackerearth1"
Moritz
20 Oct 2018
1import itertools
2def MainProg(items):
3    n = len(items)
4    count = 0
5    if n==0: yield []
6    else:
7        for i in range(len(items)):
8            for cc in MainProg(items[:i]+items[i+3:]):
9                yield [items[i]]+cc
10                count += 1
11for i in MainProg(list("red")): print(''.join(i) + ", ", end="")
12result = MainProg(['t','a','n'])
13next(result)
14print(next(result))  
15
similar questions
queries leading to this page
hackerearth1