Ezvor

3157. Find the Level of Tree with Minimum Sum

MediumTree Preparing judge… LeetCode
TreeDepth-First SearchBreadth-First SearchBinary Tree

Hints

Hint 1
Run a DFS on the tree and update an array sum where sum[i] is the sum for level i.
Hint 2
The answer is the first minimum element of sum.