LeetCode 112 路径总和
Opened this issue · 0 comments
InnocentLi commented
if(!root)return false;
if(root->left == NULL && root->right == NULL && sum == root->val)return true;
sum -= root->val;
return hasPathSum(root->left, sum) || hasPathSum(root->right, sum);