package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/cut-the-tree
 */
public class CutTheTree {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // TODO
    }
}

@@ -14,16 +14,115 @@
 rrank;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A
 import j
@@ -237,108 +237,945 @@
    p
-ublic static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        // TODO
+rivate static class Vertex %7B%0A        private final int vertex;%0A        private final int value;%0A%0A        public Vertex(int vertex, int value) %7B%0A            this.vertex = vertex;%0A            this.value = value;%0A        %7D%0A    %7D%0A%0A    private static int cutTheTree(Map%3CInteger, List%3CVertex%3E%3E adjList) %7B%0A        // TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        int n = in.nextInt();%0A        Map%3CInteger, Vertex%3E vertices = new HashMap%3C%3E();%0A        Map%3CInteger, List%3CVertex%3E%3E adjList = new HashMap%3C%3E();%0A        for (int i = 1; i %3C= n; i++) %7B%0A            int val = in.nextInt();%0A            vertices.put(i, new Vertex(i, val));%0A            adjList.put(i, new ArrayList%3C%3E());%0A        %7D%0A        for (int i = 1; i %3C= n - 1; i++) %7B%0A            int from = in.nextInt();%0A            int to = in.nextInt();%0A            adjList.get(from).add(vertices.get(to));%0A        %7D
 %0A   

Update Cut The Tree