方法1:递归 /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ bool hasPath ...
分类:
其他好文 时间:
2020-07-07 10:22:49
阅读次数:
60
题目来源:leetcode617 合并二叉树 题目描述: 给定两个二叉树,想象当你将它们中的一个覆盖到另一个上时,两个二叉树的一些节点便会重叠。 你需要将他们合并为一个新的二叉树。合并的规则是如果两个节点重叠,那么将他们的值相加作为节点合并后的新值,否则不为 NULL 的节点将直接作为新二叉树的节点 ...
分类:
其他好文 时间:
2020-07-07 10:17:13
阅读次数:
67
题目来源:leetcode226 翻转二叉树 题目描述: 翻转一棵二叉树。 解题思路 递归 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *ri ...
分类:
其他好文 时间:
2020-07-07 10:00:25
阅读次数:
51
package LeetCode_1008 /** * 1008. Construct Binary Search Tree from Preorder Traversal * https://leetcode.com/problems/construct-binary-search-tree-fr ...
分类:
其他好文 时间:
2020-07-06 23:57:45
阅读次数:
88
工具-选项 "C:\Program Files\Beyond Compare 4\BCompare.exe" %1 %2 ...
分类:
其他好文 时间:
2020-07-06 20:12:30
阅读次数:
65
题目: 求给定的二叉树的前序遍历。 例如: 给定的二叉树为{1,#,2,3}, 1 2 / 3 返回:[1,2,3] 代码: 1 /** 2 * struct TreeNode { 3 * int val; 4 * struct TreeNode *left; 5 * struct TreeNode ...
分类:
其他好文 时间:
2020-07-06 17:50:18
阅读次数:
44
一、安装依赖,redis是C语言写的 [root@t2 ~]# yum install -y gcc 二、下载redis mkdir /app && cd app[root@t2 app]# wget http://download.redis.io/releases/redis-5.0.8.tar ...
分类:
其他好文 时间:
2020-07-06 12:57:49
阅读次数:
49
mplayer移植过程中发现, gcc 4.8有个BUG:缺少stdatomic.h, 需要升级gcc版本。 1. 可以通过以下命令查看gcc版本: $: gcc -v 2. 输入以下3条命令对gcc进行升级:升级过程比较慢,耐心等待... $: sudo add-apt-repository pp ...
分类:
系统相关 时间:
2020-07-06 11:11:40
阅读次数:
160
3、卸载低版本git# yum remove git14、依赖库安装# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel# yum install gcc perl-ExtUtils-MakeMaker ...
分类:
其他好文 时间:
2020-07-06 01:29:17
阅读次数:
111
题目描述 给定一个二叉树,原地将它展开为一个单链表。 例如,给定二叉树 1 / \ 2 5 / \ \3 4 6将其展开为: 1 \ 2 \ 3 \ 4 \ 5 \ 6 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/flatten-binary ...
分类:
其他好文 时间:
2020-07-05 19:16:52
阅读次数:
57