Approach hintTry it first, then revealHide
Keep a hash map of prefix sums along the current root-to-node path. The paths ending at a node correspond to earlier prefix sums equal to current - targetSum; remove the node's prefix when the DFS returns.