30:00
Given the root of a binary tree, return the sum of values of its deepest leaves.
root
The number of nodes in the tree is in the range [1,104][1, 10^4][1,104].
1≤Node.val≤1001 \leq \text{Node.val} \leq 1001≤Node.val≤100
Run code to see results.
Start with level = [1]. Each pass of the loop sums one whole row, and the sum restarts at every new row.
total
0
level
next
empty
Given a binary tree, return the sum of the values on its deepest row. Every node on that row is a leaf, since nothing lies below it.