Skip to content

Commit d27a6cd

Browse files
add a solution for 1339
1 parent cbe4c52 commit d27a6cd

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

Diff for: src/main/java/com/fishercoder/solutions/secondthousand/_1339.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ private void postOrderBuildProductList(TreeNode root, Map<TreeNode, Long> sumMap
6262
postOrderBuildProductList(root.left, sumMap, productList, total);
6363
postOrderBuildProductList(root.right, sumMap, productList, total);
6464
if (root.left != null) {
65-
//cut off left child
65+
//suppose we cut off left subtree now
6666
long leftSum = sumMap.get(root.left);
6767
long remainder = total - leftSum;
6868
productList.add(new long[]{leftSum, remainder});
6969
}
7070
if (root.right != null) {
71+
//suppose we cut off right subtree now
7172
long rightSum = sumMap.get(root.right);
7273
long remainder = total - rightSum;
7374
productList.add(new long[]{rightSum, remainder});

0 commit comments

Comments
 (0)