文章目录
  1. 1. Sum Of Left Leaves

Sum Of Left Leaves


1
2
3
4
5
6
7
8
9
10
11
12
int helper(TreeNode *node, bool isFromLeft)
{
if (node != NULL)
{
if (isFromLeft && node->left == NULL && node->right == NULL)
return node->val;
else
return helper(node->left, true) + helper(node->right, false);
}
else
return 0;
}
文章目录
  1. 1. Sum Of Left Leaves