Given the root of a binary tree and an integer targetSum, return the number of distinct downward paths whose node values add up exactly to targetSum.
A downward path is any sequence of nodes that starts at some node and repeatedly moves to either the left child or the right child. The path does not need to start at root and does not need to end at a leaf, but it must contain at least one node.
Constraints:
The number of nodes in the tree is in the range
Node.val
targetSum
Given the root of a binary tree and an integer targetSum, return the number of distinct downward paths whose node values add up exactly to targetSum.
A downward path is any sequence of nodes that starts at some node and repeatedly moves to either the left child or the right child. The path does not need to start at root and does not need to end at a leaf, but it must contain at least one node.
Constraints:
The number of nodes in the tree is in the range
Node.val
targetSum