[파이썬/python] 백준 15649번 : N과 M (1) (🥈3)

n,m = list(map(int,input().split()))
 
s = []
 
def dfs():
    if len(s)==m:
        print(' '.join(map(str,s)))
        return
    
    for i in range(1,n+1):
        if i not in s:
            s.append(i)
            dfs()
            s.pop()
 
dfs()

처음 접해보는 알고리즘 기법이라 다른 분의 풀이를 보고 배꼈다.. (🔗)

 

 

챗지피티의 설명..

 

 

comment