sum root to leaf
来源:互联网 发布:杭州淘宝诈骗案进展 编辑:程序博客网 时间:2024/06/03 18:38
int sum(TreeNode* root,int sum)
{
if(root==nullptr)
return 0;
if(root->left==nullptr&&root->right==nullptr)
return sum*10+root->val;
return sum(root->left,sum*10+root->val)+sum(root->right,sum*10+root->val);
}
int sum(TreeNode* root)
{
return sum(root,0);
}
0 0
- sum root to leaf
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- Sum Root to Leaf Numbers
- 代码实现自定义键盘工具条
- Android绘制的一些总结onMeasure,onLayout,onDraw
- js中的一些数字处理方法
- UVALive 4288 Cat vs. Dog
- java设计模式第4弹--桥接模式
- sum root to leaf
- Examining the Compilation Process
- hadoop 词频统计&&adoop jar jar包名.jar 包名.主类名 输入路径(文件的目录,不包括文件本身) 输出路径
- IntentService,(Looper,Message,Handler)三者之间的关系,AsyncTask,
- (视频)vivi驱动层代码分析
- 原型模式的浅克隆和深克隆
- Effective C++——条款31(第5章)
- Mac 系统开机启动nginx,php
- css选择器优先级