Go | 100% Time | Recursion
golang []\nvar sizes []int\nfunc kthLargestPerfectSubtree(root *TreeNode, k int) int {\n    sizes = []int{}\n    deep(root)\n\n    if len(sizes) < k {\n        
```golang []\nvar sizes []int\nfunc kthLargestPerfectSubtree(root *TreeNode, k int) int {\n    sizes = []int{}\n    deep(root)\n\n    if len(sizes) < k {\n        return -1\n    }\n    \n    sort.Ints(sizes)\n    return sizes[len(sizes)-k]\n}\n\n// Recursively traverses tree,\n// calculating its size and whether it is Perfect\nfunc deep(node *TreeNode) (size int, isPerfect bool) {\n    if node == nil {\n        return 0, true\n    }\n\n    sizeL,perfL := deep(node.Left)\n    sizeR,perfR := deep(node.Right)\n\n    // If sizes of left and right trees are equals and both perfect\n    // then current tree also perfect\n    if sizeL == sizeR && perfL && perfR {\n        // Size is the current tree plus left and right childs sizes\n        size := 1 + sizeL + sizeR\n        // Store size of current tree to global variable `sizes`\n        sizes = append(sizes, size)\n        return size, true\n    }\n    return 0, false\n}\n```
['Go']