Path Sum Equal To Given Value

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.

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. 
Question Video
Constraints
0 <= Number of Nodes <= 10^5
-1000 <= value of Node data <= 1000

Sample Input
10 5 3 3 null null -2 null null 2 null 1 null null -3 null 11 null null
8
Sample Output
3


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name