Path Sum
Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.
Path Sum

Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.

Example 1:
Input: {"root":[5,4,8,11,null,13,4,7,2,null,null,null,1],"targetSum":22}
Output: true
Input
arr ={"root":[5,4,8,11,null,13,4,7,2,null,null,null,1],"targetSum":22}
Target
22

5

4

8

11

13

4

7

2

1

Variables
VariableValue
val5
remSum22
DepthFunction Call
0hasPathSumnode=5, remSum=22
0/12