✅ Simple Java Solution
CODE\nJava []\nprivate int solve(TreeNode root, List<Integer> list) {\n\tif(root == null) return 0;\n\n\tint left = solve(root.left, list);\n\tint right = solve
## **CODE**\n```Java []\nprivate int solve(TreeNode root, List<Integer> list) {\n\tif(root == null) return 0;\n\n\tint left = solve(root.left, list);\n\tint right = solve(root.right, list);\n\tif(left > -1 && left == right) {\n\t\tlist.add(left*2 + 1);\n\t\treturn left*2+1;\n\t} else {\n\t\treturn -1;\n\t}\n}\n\npublic int kthLargestPerfectSubtree(TreeNode root, int k) {\n\tList<Integer> list = new ArrayList<>();\n\tsolve(root, list);\n\n\tif(list.size() < k) return -1;\n\n\tCollections.sort(list, Collections.reverseOrder());\n\treturn list.get(k-1);\n}\n```
['Depth-First Search', 'Binary Tree', 'Java']