Kakao Interview Question

Simple DFS dp BFS problems