Givenabinarytree,checkwhetheritisamirrorofitself(ie,symmetricarounditscenter).Forexample,thisbinarytreeissymmetric:1
/22
/\/3443Butthefollowingisnot:1
/22
\33Note:Bonuspointsifyoucouldsolveitbothrecursivelyanditeratively.解法一:递归方法,判断一个二..
分类:
其他好文 时间:
2016-04-08 15:23:27
阅读次数:
126
水题。枚举中间,暴力算最远的。也可以用(Manacher) ...
分类:
其他好文 时间:
2016-04-06 09:24:33
阅读次数:
143
题目链接:https://leetcode.com/problems/symmetric-tree/
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
...
分类:
其他好文 时间:
2016-04-01 18:28:40
阅读次数:
176
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 /
分类:
其他好文 时间:
2016-03-16 09:30:47
阅读次数:
113
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1
/ 2 2
/ \ / 3 4 4 3
But the following is...
分类:
其他好文 时间:
2016-03-13 18:06:55
阅读次数:
153
题目来源: https://leetcode.com/problems/symmetric-tree/ 题意分析: 判断一棵树是不是镜像树。 题目思路: 判断左子树的左右子树是不是和右子树的右左子树相同。 代码(python): # Definition for a binary tree node
分类:
编程语言 时间:
2016-03-07 19:14:27
阅读次数:
175
以每个字符为中心,分两种情况向两边扩展。 manacher算法参见http://www.cnblogs.com/houkai/p/3371807.html AC代码: #include <string> #include <cstdio> #include <iostream> using name
分类:
其他好文 时间:
2016-03-02 16:31:42
阅读次数:
142
判断一棵树是否自对称 可以回忆我们做过的Leetcode 100 Same Tree 二叉树和Leetcode 226 Invert Binary Tree 二叉树 先可以将左子树进行Invert Binary Tree,然后用Same Tree比较左右子树 而我的做法是改下Same Tree的函数
分类:
其他好文 时间:
2016-03-01 20:45:19
阅读次数:
148
Symmetric Tree:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetr...
分类:
其他好文 时间:
2016-03-01 20:40:52
阅读次数:
124
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 /
分类:
其他好文 时间:
2016-01-30 17:51:16
阅读次数:
113