Path Sum Equal To Given Value

medium
1. Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum.
2. The path does not need to start or end at the root or a leaf,path can start from any where but it must go downwards

Input Format

Input is managed for you.

Output Format

Output is managed for you.

Constraints

0 <= Number of Nodes <= 10^5
-1000 <= value of Node data <= 1000

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
10 5 3 3 null null -2 null null 2 null 1 null null -3 null 11 null null
8
Output
3
Previous
Maximum Width Of Binary Tree
Next
Lowest Common Ancestor Of A Binary Tree

Related Questions