Problem 1161 · Medium

Maximum Level Sum of a Binary Tree

Sum each level with a breadth-first walk and keep the smallest level index that reaches the largest sum.

Open the interactive visualisation