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的更多相关文章

  1. [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 ...

  2. leetcode814 Binary Tree Pruning

    """ We are given the head node root of a binary tree, where additionally every node's ...

随机推荐

  1. jxl将list导入到Excel中供下载

    jxl操作excel /** * 分隔符 */ private final static String SEPARATOR = "|"; /** * 由List导出至指定的Shee ...

  2. js控制easyui datagrid列的显示和隐藏

    easyui datagrid 列隐藏和显示 $('#grid').datagrid('hideColumn','列field'); //把hideColumn换成showColumn 即为显示列

  3. Life Cycle(JSF+Facelets)

    一.JSF Life Cycle: 图1 图2 应用程序的生命周期是指应用程序的各个阶段,从开始到结束.所有应用程序的生命周期.在web应用程序生命周期中,执行常见任务,包括以下内容.■处理传入的请求 ...

  4. 在centos7下安装java8和mysql

    一般学习java和部署项目都是在本地部署,但是生产环境一般都是在linux环境下,部署和安装环境都是在控制台下进行操作的,没有windows的可视化的操作界面,对与linux的命令掌握和操作对小白来说 ...

  5. 如何创建管理员权限的CMD命令提示符窗口

    最近在使用netstat -anob命令时提示 请求的操作需要提升. 总结了几种创建管理员权限的CMD命令行的方法. 创建临时管理员权限的CMD Win8系统: 按下windows徽标,直接输入cmd ...

  6. 『转』三星推出Android智能手表Galaxy Gear

    苹果定下来本月10日召开新品发布会,而它的竞争对手三星却抢先一步.今天凌晨,三星在德国柏林一口气发布了三款重量级产品.三星智能手表Galaxy Gear最引人关注,其将于9月25日陆续在全球上市,售价 ...

  7. haskell 常用 函数

    在学习haskell 记录以下常用的函数 随时更新! span  span :: (a -> Bool) -> [a] -> ([a], [a]) span, applied to ...

  8. 错误 1 类,结构或接口成员声明中的标记"="无效

    using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace Console ...

  9. 第10课 struct和union分析

    struct的小秘密:空结构体占多大内存呢? 直观的答案有两种: 1.空结构体的大小为0 2.结构体本来就是为了将不同的变量集合在一起使用的,定义空结构体会导致编译错误 实例分析: #include ...

  10. BZOJ4917: [Lydsy1706月赛]Hash Killer IV(模拟)

    4917: [Lydsy1706月赛]Hash Killer IV Time Limit: 1 Sec  Memory Limit: 256 MBSubmit: 327  Solved: 140[Su ...