Skip to content

Commit fab5c6c

Browse files
committed
Runtime: 19 ms (Top 20.53%) | Memory: 72.3 MB (Top 15.91%)
1 parent 22828da commit fab5c6c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/algorithms/M/Maximum Level Sum of a Binary Tree/Maximum Level Sum of a Binary Tree.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// Runtime: 19 ms (Top 20.53%) | Memory: 72.3 MB (Top 15.91%)
2+
13
class Solution {
24
Map<Integer, Integer> map = new HashMap<>();
3-
5+
46
public void go(TreeNode root, int level) {
57
if(root == null) return;
68
if(map.containsKey(level)) {
@@ -9,7 +11,7 @@ public void go(TreeNode root, int level) {
911
else {
1012
map.put(level, root.val);
1113
}
12-
14+
1315
go(root.left, level+1);
1416
go(root.right, level+1);
1517
}
@@ -24,4 +26,4 @@ public int maxLevelSum(TreeNode root) {
2426
}
2527
return ind+1;
2628
}
27-
}
29+
}

0 commit comments

Comments
 (0)