Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0b52ab

Browse files
refactor 1161
1 parent4b2f693 commitc0b52ab

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

‎src/main/java/com/fishercoder/solutions/_1161.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,6 @@
66
importjava.util.Queue;
77
importjava.util.TreeMap;
88

9-
/**
10-
* 1161. Maximum Level Sum of a Binary Tree
11-
*
12-
* Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on.
13-
* Return the smallest level X such that the sum of all the values of nodes at level X is maximal.
14-
*
15-
* Example 1:
16-
* 1
17-
* / \
18-
* 7 0
19-
* / \
20-
* 7 -8
21-
*
22-
* Input: [1,7,0,7,-8,null,null]
23-
* Output: 2
24-
*
25-
* Explanation:
26-
* Level 1 sum = 1.
27-
* Level 2 sum = 7 + 0 = 7.
28-
* Level 3 sum = 7 + -8 = -1.
29-
* So we return the level with the maximum sum which is level 2.
30-
*
31-
* Note:
32-
* The number of nodes in the given tree is between 1 and 10^4.
33-
* -10^5 <= node.val <= 10^5
34-
* */
359
publicclass_1161 {
3610
publicstaticclassSolution1 {
3711
publicintmaxLevelSum(TreeNoderoot) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp