강의

멘토링

커뮤니티

Inflearn Community Q&A

gumsanim19931682's profile image
gumsanim19931682

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

8. Duplicate permutation (difference between multiple for loops and recursion)

else문에서 반복문과 DFS가 어떻게 돌아가는지 보충 설명 부탁드리겠습니다...

Written on

·

222

0

안녕하세요 강사님.

강의 잘 듣고 있습니다.
 
다름이 아니라 else 문에서 반복문과 DFS가 어떤 순서로 돌아가는지 감이 좀 안잡히는데 보충 설명 가능하실까요?
반복문이 1~3까지 도는데 i 값이 1일때 DFS가 또 호출되고 다시 돌아올 때 i 값은 2부터 시작이 되는걸까요?
javascript코테 준비 같이 해요!

Answer 1

1

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

네 맞습니다. 다시 되돌아 오면 호출했던 당시 상황으로 i값이 1인 상황으로 오는데 i값이 1일때는 호출을 했으니 안하고 for문의 i가 하나 증가해서 i값이 2일때 다시 재귀호출이 일어나는 것입니다.

Jay Choi님의 프로필 이미지
Jay Choi
Questioner

답변 감사합니다!

gumsanim19931682's profile image
gumsanim19931682

asked

Ask a question