404. Sum of Left Leaves
来源:互联网 发布:sql计算留存率算法 编辑:程序博客网 时间:2024/05/01 00:30
class Solution {private: int count=0; void sumhelper(TreeNode* root,bool isleft) { if(!root) return; if(isleft&&!root->left&&!root->right) count+=root->val; if(root->left) sumhelper(root->left,true); if(root->right) sumhelper(root->right,false); }public: int sumOfLeftLeaves(TreeNode* root) { sumhelper(root,false); return count; }};
1 0
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves*
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- 404. Sum of Left Leaves
- TextRank 算法提取关键词的 Java 实现
- Bangu详解(二)--- Tools安装脚本
- Hadoop的HDFS Java pai 读写操作
- Hdu1548 A strange lift
- 2016华为、腾讯、360、网易、滴滴面试
- 404. Sum of Left Leaves
- JVM常用分析工具JPS/JINFO/JSTACK/JSTAT/JMAP详解
- python for 循环
- 名字的作用域
- ZCMU-1607-大二下之悬梁刺股
- 算法与游戏之OBB碰撞算法
- 我遇到的$.ajaxFileUpload is not a function
- IE条件注释详解
- TeamTalk源码分析之login_server