Easy Solution || DFS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    long max = 0;\n\n    public int countHighestScoreNodes(int[] parents) {\n        List<List<Integer>> adj = new ArrayList<>();\n        int n = parents.length;\n        for (int i = 0; i < n; i++) {\n            adj.add(new ArrayList<>());\n        }\n\n        for (int i = 1; i < n; i++) {\n\n            adj.get(parents[i]).add(i);\n        }\n        int subtree[] = new int[n];\n        long score[] = new long[n];\n        Subtree(adj, 0, subtree,parents,score,n);\n         System.out.println(Arrays.toString(subtree));\n        // System.out.println(adj);\n        int cnt = 0;\n        for (int i = 0; i < n; i++) {\n            if (score[i] == max)\n                cnt++;\n        }\n        return cnt;\n\n    }\n\n    public int Subtree(List<List<Integer>> adj, int i, int subtree[], int parents[], long score[],int n) {\n        if (adj.get(i).size() == 0) // leaf node\n        {\n            subtree[i] = 1;\n            score[i] = (n - subtree[i]);\n            max = Math.max(max, score[i]);\n            return 1;\n        }\n        int size = 0;\n        long prod = 1;\n\n        for (int neighbor : adj.get(i)) {\n            size += Subtree(adj, neighbor, subtree,parents,score,n);\n            prod *= subtree[neighbor];\n        }\n\n        subtree[i] = 1 + size;\n        if (parents[i] != -1) {\n            prod *= (n - subtree[i]);\n        }\n        score[i] = prod;\n        max = Math.max(max, prod);\n        return subtree[i];\n    }\n \n}\n```
['Java']