1260 DFS와 BFS / DFS, BFS
정답from collections import dequedef DFS(graph, start, visited, dfs_ans): visited[start] = True dfs_ans.append(start) for i in graph[start]: if visited[i] is False: DFS(graph, i, visited, dfs_ans)def BFS(graph, start, visited, bfs_ans): queue = deque() queue.append(start) visited[start] = True while queue: v = queue.popleft() bfs_ans.append(v) ..