File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
src/main/java/com/fishercoder/solutions/secondthousand Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,13 @@ private void postOrderBuildProductList(TreeNode root, Map sumMap
62
62
postOrderBuildProductList (root .left , sumMap , productList , total );
63
63
postOrderBuildProductList (root .right , sumMap , productList , total );
64
64
if (root .left != null ) {
65
- //cut off left child
65
+ //suppose we cut off left subtree now
66
66
long leftSum = sumMap .get (root .left );
67
67
long remainder = total - leftSum ;
68
68
productList .add (new long []{leftSum , remainder });
69
69
}
70
70
if (root .right != null ) {
71
+ //suppose we cut off right subtree now
71
72
long rightSum = sumMap .get (root .right );
72
73
long remainder = total - rightSum ;
73
74
productList .add (new long []{rightSum , remainder });
You can’t perform that action at this time.
0 commit comments