```
var hasPathSum = function(root, sum) {
if (!root) return false;
if (root.val - sum === 0) {
return true;
} else {
return (root.left && hasPathSum(root.left, sum - root.left.val)) || (root.right && hasPathSum(root.right, sum - root.right.val));
}
```

};

Hi,

Could someone explains why my code does not return false with this input:

` {1}, 0`