Maximum Level Sum of a Binary Tree

Medium · Trees · about 10 minutes

Asked at Amazon, Google, Microsoft, Meta.

Number the tree's levels from 1 at the root downward and add up the values on each level. Return the number of the level with the largest total; if several levels tie, return the lowest number.

Related guides