로딩
요청 처리 중입니다...

프로그래머스 가장 먼 노드 - java

 프로그래머스 가장 먼 노드 - java

import java.util.*; class Solution { public static Queue bfs = new LinkedList(); public static ArrayList graph = new ArrayList(); public int solution(int n, int[][] edge) { int answer = 0; for (int i = 0; i <= n; i++) { ArrayList node = new ArrayList(); graph.add(node); } for (int i = 0; i < edge.length; i++) { graph.get(edge[i][0]).add(edge[i][1]); graph.get(edge[i][1]).add(edge[i][0]); } boolean[] visitedFlag = new boolean[n+1]; int[] distanceAndNode...