leetcode814
class Solution {
public:
TreeNode* pruneTree(TreeNode* root) {
if(root==NULL)
{
return nullptr;
}
if(root->left!=NULL)
{
root->left = pruneTree(root->left);
}
if(root->right!=NULL)
{
root->right = pruneTree(root->right);
}
if(root->left==NULL&&root->right==NULL&&root->val==)
{
return NULL;
}
return root;
}
};
leetcode814的更多相关文章
- [Swift]LeetCode814. 二叉树剪枝 | Binary Tree Pruning
We are given the head node root of a binary tree, where additionally every node's value is either a ...
- leetcode814 Binary Tree Pruning
""" We are given the head node root of a binary tree, where additionally every node's ...
随机推荐
- 【转】ubuntu下修改文件夹权限
常用方法如下: sudo chmod 600 ××× (只有所有者有读和写的权限)sudo chmod 644 ××× (所有者有读和写的权限,组用户只有读的权限)sudo chmod 700 ××× ...
- Idea2018激活
[help]-->[register]-->[license server]-->输入下方链接 http://xdouble.cn:8888/ 如果不行,请用下面的这个: http: ...
- gruntjs开发实例
Grunt是基于Node.js的项目构建工具.它可以自动运行你所设定的任务,如编译less,sass,压缩js,合拼文件等等. (一)安装nodejs环境,Grunt 0.4.x要求Node.js的版 ...
- IE6开发调试插件:IE Developer Toolbar
下载地址:http://www.microsoft.com/en-us/download/details.aspx?id=18359 1.下载后点击安装 2.安装后重启IE6
- 外汇EA(LRY_FX_Robot_V5)
EA介绍 EA类型是马丁+策略,EA主要功能有风控设置(预付款.浮亏.加仓层数等达到多少进行操作).移动止损(包括隐藏移动止损).帮我操作手动单子(如果你开了首仓不会操作这个功能可参帮你加仓平仓移动止 ...
- Linux udhcp client (udhcpc) get IP at anytime
/*************************************************************************************** * Linux udh ...
- 老毛桃(U盘启动盘)
1.制作U盘启动盘: http://www.laomaotao.org/jiaocheng/92/upzwin7.html 2.老毛桃U盘快速安装gost win7系统教程: http://www.l ...
- Java与WCF交互(一):Java客户端调用WCF服务 【转】
原文:http://www.cnblogs.com/downmoon/archive/2010/08/24/1807161.html 最近开始了解WCF,写了个最简单的Helloworld,想通过ja ...
- [Luogu4899][IOI2018] werewolf 狼人
luogu sol \(\mbox{IOI2018}\)的出题人有没有看过\(\mbox{NOI2018}\)的题目呀... \(\mbox{Kruskal}\)重构树+二维数点. 题目相当于是问你从 ...
- test20181024 hao
题意 分析 考场10分 直接\(O(nm)\)模拟即可. #include<cstdlib> #include<cstdio> #include<cmath> #i ...