최장 경로 = 방문한 정점의 수 풀이 : 무방향 그래프 -> dfs, visited[], ArrayList() 사용해서 방문했던 곳은 패스하고, 새로 방문하는 정점들을 타고 들어가면서 cnt++ Code public class Solution2814v { static int N, M, ans; static boolean[] visited; static ArrayList[] start; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int tc = 1; tc