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.
root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22trueroot = [1,2,3], targetSum = 5false
Passing rem = target − node.val converts the path-sum check into a single equality at the leaf: rem == 0. The || operator short-circuits — once any valid path is found the recursion unwinds immediately without exploring further nodes.