Free written solutionKth Largest Sum in a Binary Tree (LeetCode 2583): Solution and Explanation
Add up the values on each level of a binary tree, then return the k-th largest of those level sums. If the tree has fewer than k levels, return -1.
Read the intuition, approach, code and complexity →