Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b269670

Browse files
refactor 538
1 parent b4e6ab7 commit b269670

File tree

1 file changed

+2
-4
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+2
-4
lines changed

src/main/java/com/fishercoder/solutions/_538.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ private int dfs(TreeNode root, int val) {
4141
if (root == null) {
4242
return val;
4343
}
44-
int right = dfs(root.right, val);
45-
root.val += right;
46-
int left = dfs(root.left, root.val);
47-
return left;
44+
root.val += dfs(root.right, val);
45+
return dfs(root.left, root.val);
4846
}
4947
}
5048

0 commit comments

Comments
 (0)