Skip to content

Commit efaf610

Browse files
committed
[ADD] BackTracking-15651
1 parent 0bb234b commit efaf610

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

BackTracking/15651.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# FULL EDIT EXSITING 15649 CODE BECAUSE OF TIME COMPLEXITY ( OPTIMISE CODE FOR SPEED )
2+
output_list = []
3+
N, M = map(int,input().split())
4+
5+
def NM_Problem():
6+
if(len(output_list) == M):
7+
print(" ".join(map(str,output_list)))
8+
return
9+
for posible_num in range(1, N+1):
10+
output_list.append(posible_num)
11+
NM_Problem()
12+
output_list.pop()
13+
return
14+
NM_Problem()
15+

0 commit comments

Comments
 (0)