Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Find the sum of values of nodes on each level and return the kth largest one.
To find the sum of the values of nodes on each level, you can use a DFS or BFS algorithm to traverse the tree and keep track of the level of each node.