[leetcode]404. Sum of Left Leaves
来源:互联网 发布:sqlite可视化软件 编辑:程序博客网 时间:2024/05/17 05:50
404. Sum of Left Leaves
Find the sum of all left leaves in a given binary tree.
Example:
3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.
int sumOfLeftLeaves(TreeNode* root) { if( root == nullptr ) return 0; if( root->left == nullptr && root->right == nullptr ) return 0; if( root->left != nullptr && root->left->left == nullptr && root->left->right == nullptr ) return root->left->val + sumOfLeftLeaves( root->right ); return sumOfLeftLeaves( root->left ) + sumOfLeftLeaves( root->right ); }
0 0
- LeetCode笔记:404. Sum of Left Leaves
- 【leetcode】404. Sum of Left Leaves【E】
- LeetCode—404. Sum of Left Leaves
- [LeetCode]404. Sum of Left Leaves
- Leetcode 404. Sum of Left Leaves
- LeetCode 404. Sum of Left Leaves
- 404. Sum of Left Leaves - leetcode
- [LeetCode]--404. Sum of Left Leaves
- LeetCode 404. Sum of Left Leaves
- [leetcode]404. Sum of Left Leaves
- LeetCode-404. Sum of Left Leaves
- LeetCode 404. Sum of Left Leaves
- LeetCode 404. Sum of Left Leaves
- leetcode 404. Sum of Left Leaves
- leetcode(88).404. Sum of Left Leaves
- 【LeetCode】 404. Sum of Left Leaves
- leetcode 404. Sum of Left Leaves
- [Leetcode]404. Sum of Left Leaves
- angularjs compile和link的区别
- TThread,Delphi线程
- RocketMQ
- 获取可用内存
- hdu1978_How many ways
- [leetcode]404. Sum of Left Leaves
- swift debug 输出
- 通过MapReduce使用HBase解决第三方jar包依赖的方式
- 【第8周项目5 - 计数的模式匹配】
- ORA-00904: invalid identifier标识符无效
- 第八周项目2- 建立链串的算法库
- boost库中 不同版本载入lib的方式
- 打造自己的 DockerImage
- ExcelUtil