Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree. For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2015-08-28 00:29:50
阅读次数:
131
from leetcode?https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/ 比如序列 2, 1, 3 是如下图的BST的preorder 序列: 但是2, 3, 1就不会是一个preorder序列; 先复习一下BST,给...
分类:
其他好文 时间:
2015-08-27 23:19:14
阅读次数:
681
LeetCode 110 : Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subt...
分类:
其他好文 时间:
2015-08-27 23:10:30
阅读次数:
141
Complete Binary Search Tree 完全 二叉 搜索数题意理解二叉搜索数 左小右大完全二叉树 结构规律完全二叉搜索数到底用什么数据结构来表示这个树呢?链表还是数组。1、由于是完全二叉树,所以我们能准确的算出来左子树有多少个结点。 完全二叉树+n个树 -> 左子树...
分类:
其他好文 时间:
2015-08-27 22:37:43
阅读次数:
240
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
题目描述:
...
分类:
其他好文 时间:
2015-08-27 18:50:15
阅读次数:
99
题目链接:https://leetcode.com/problems/balanced-binary-tree/
题目:
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree...
分类:
其他好文 时间:
2015-08-27 18:44:11
阅读次数:
185
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 f...
分类:
其他好文 时间:
2015-08-27 18:42:27
阅读次数:
127
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
...
分类:
其他好文 时间:
2015-08-27 18:42:25
阅读次数:
158
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f...
分类:
其他好文 时间:
2015-08-27 18:19:03
阅读次数:
142
题目链接:https://leetcode.com/submissions/detail/37771540/
题目:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ 2 3
5
...
分类:
其他好文 时间:
2015-08-27 16:45:00
阅读次数:
133