Tap here to switch tabs
Problem
Submissions

Problem: Find the Level of Tree with Minimum Sum

Find the Level of Tree with Minimum Sum asks you to examine a binary tree and return the level whose node values have the smallest total, choosing the earliest level when sums tie.

Statement

Given the root of a binary tree, return the level that has the minimum sum of node values.

The level of the root is 11, the level of its children is 22, and so on.

If there is a tie for the minimum sum across multiple levels, return the smallest level number.

Constraints:

  • The number of nodes in the tree is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Level of Tree with Minimum Sum

Find the Level of Tree with Minimum Sum asks you to examine a binary tree and return the level whose node values have the smallest total, choosing the earliest level when sums tie.

Statement

Given the root of a binary tree, return the level that has the minimum sum of node values.

The level of the root is 11, the level of its children is 22, and so on.

If there is a tie for the minimum sum across multiple levels, return the smallest level number.

Constraints:

  • The number of nodes in the tree is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤109\leq 10^9