@marcusgao94 I know why at the end you have to let preSum(currSum) - 1
as you know, with the reference viriable preSum to refer the Hashmap, all the recursion uses the same Hashmap preSum.
If you don't delete the current node's prefix Sum's frequency at the end of recursion, when you done scanning the left subtree, the results of left in the Hashmap will totally influence right subtrees' frequency result. So to offset the exaggeration, you have to let preSum(currSum) - 1.
Or the results will include path that does not go downwards