Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
For a subtree to form a perfect binary subtree, its children should also be perfect binary subtrees.
Check recursively that both the node and its children are perfect binary subtrees.
Gather all the perfect binary subtrees and return the kth largest.