2
public int minTime(int n, int[][] edges, List<Boolean> hasApple) {3
HashMap<Integer, List<Integer>> graph = new HashMap<>(n);4
for (int edge[] : edges) {5
int a = edge[0], b = edge[1];6
graph.putIfAbsent(a, new LinkedList<>());7
graph.putIfAbsent(b, new LinkedList<>());12
boolean[] visited = new boolean[n];13
Arrays.fill(visited, false);15
int a = move(0, graph, hasApple, n, visited);17
return a == -1 ? 0 : a;22
HashMap<Integer, List<Integer>> graph,23
List<Boolean> hasApple,28
if (hasApple.get(i)) {32
List<Integer> list = graph.get(i);40
int a = move(k, graph, hasApple, n, visited);46
if (j == 0 && cont) return 0;47
return j == 0 ? -1 : j;