Postorder traverse, java, most intuitive solution
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 []\n/**\n * Definition for a binary tree node.\n * public class TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() {}\n *     TreeNode(int val) { this.val = val; }\n *     TreeNode(int val, TreeNode left, TreeNode right) {\n *         this.val = val;\n *         this.left = left;\n *         this.right = right;\n *     }\n * }\n */\nclass Solution {\n    public int kthLargestPerfectSubtree(TreeNode root, int k) {\n        if (root == null || k <= 0) {\n            return -1;\n        }\n        List<Integer> list = new ArrayList<>();\n        isPerfect(root, list);\n\n        Collections.sort(list);\n        if (list.size() < k) {\n            return -1;\n        }\n        return list.get(list.size() - k);\n    }\n\n    // int[0] = 0: not perfect, int[0] = 1: is perfect; int[1]: count of nodes\n    private int[] isPerfect(TreeNode root, List<Integer> list) {\n        if (root == null) {\n            return new int[] {1, 0}; \n        }\n\n        if (root.left == null && root.right == null) {\n            list.add(1);\n            return new int[] {1, 1}; \n        }\n\n        int[] left = isPerfect(root.left, list);\n        int[] right = isPerfect(root.right, list);\n       \n        int[] res = new int[2];\n        // left is perfect & right is perfect & their child nodes is same\n        if (left[0] == 1 && right[0] == 1 && left[1] == right[1]) {\n            res[0] = 1;\n            res[1] = left[1] + right[1] + 1;\n            list.add(res[1]);\n        }\n        return res;\n    }\n}\n```
['Java']