Leetcode 2583. Kth Largest Sum in a Binary Tree
Compute the sum of node values at each tree level (via BFS/level-order traversal) and return the k-th largest level sum (or -1 if there are fewer than k levels). Because n can be up to 1e5, use an O(n log k) selection like a size-k min-heap or partial sort to efficiently find the k-th largest.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.