see also : https://programmers.co.kr/learn/courses/30/lessons/43165?language=javascriptfor문을 이용해 모든 경우를 다 탐색한다면 시간초과가 날 것으로 보인다. 이런 종류의 bfs, dfs는