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. 10个有趣的Javascript和CSS库

    Tailwind CSS Tailwind是用于构建自定义用户界面的实用CSS框架. 每个Tailwind小应用都有多种尺寸,这使得创建响应式界面变得非常简单. 您可以自定义颜色,边框尺寸,字体,阴影 ...

  2. Android Eclipse keystore.jks文件生成,根据keystore密钥获取SHA1安全码 ,apk打包

    keystore.jks文件生成,打包APK 选中项目右键-> Android Tools->Export Signed Application Package ,如图: 之后 点击Nex ...

  3. hell 1>&2 2>&1 &>filename重定向的含义和区别

    当初在shell中, 看到">&1"和">&2"始终不明白什么意思.经过在网上的搜索得以解惑.其实这是两种输出. 一.linux重定 ...

  4. SGU 140. Integer Sequences 线性同余,数论 难度:2

    140. Integer Sequences time limit per test: 0.25 sec. memory limit per test: 4096 KB A sequence A is ...

  5. Python+Flask+MysqL的web建设技术过程

    一.前言(个人学期总结) 个人总结一下这学期对于Python+Flask+MysqL的web建设技术过程的学习体会,Flask小辣椒框架相对于其他框架而言,更加稳定,不会有莫名其妙的错误,容错性强,运 ...

  6. python的单元测试代码编写流程

    单元测试: 单元测试是对单独的代码块分别进行测试, 以确保它们的正确性, 单元测试主要还是由开发人员来做, 其余的集成测试和系统测试由专业的测试人员来做. python的单元测试代码编写主要记住以下几 ...

  7. 51Nod 1006:最长公共子序列Lcs(打印LCS)

    1006 最长公共子序列Lcs  基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题  收藏  关注 给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的). ...

  8. Java中String.valueOf()方法的解释

    1. 由 基本数据型态转换成 String String 类别中已经提供了将基本数据型态转换成 String 的 static 方法 也就是 String.valueOf() 这个参数多载的方法 有下 ...

  9. C# 空合并操作符(??)不可重载?其实有黑科技可以间接重载!

    ?? 操作符叫做 null-coalescing operator,即 null 合并运算符.如果此运算符的左操作数不为 null,则此运算符将返回左操作数:否则返回右操作数. 在微软的官方 C# 文 ...

  10. 【Beanstalkd】Beanstalkd消息队列的安装与使用

    一.Beanstalkd是什么? Beanstalkd是一个高性能,轻量级的分布式内存队列 二.Beanstalkd特性 1.支持优先级(支持任务插队)2.延迟(实现定时任务)3.持久化(定时把内存中 ...