The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number...
分类:
其他好文 时间:
2015-05-14 23:24:41
阅读次数:
137
题目Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing all ones and return its area.思路对于上图的一个01矩阵。我们可以一行一行的分析,假设第三行,我们按列扫描,遇到0时,柱子断开,重新形成柱子,遇到1时柱子高度加一。这样的话,我们就可以把问题转换...
分类:
其他好文 时间:
2015-05-14 22:05:23
阅读次数:
137
Binary Search Tree 又叫二叉查找树,二叉排序树这是种什么样的树呢?其实就是根节点的左子树比根节点小 右子树比根节点大 同时 左子树和右子树也是二叉搜索树代码比较简单 基本用递归实现 比较好理解 只有删除带有左右子树的节点时比较难理解方法就是 直接在右子树找一个最小的节点 取代要被删...
分类:
编程语言 时间:
2015-05-14 18:08:35
阅读次数:
142
题目描述:
Reverse bits of a given 32 bits unsigned integer.
For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary a...
分类:
其他好文 时间:
2015-05-14 16:30:40
阅读次数:
102
原题Given 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 dep...
分类:
其他好文 时间:
2015-05-14 16:23:27
阅读次数:
132
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-05-14 14:19:07
阅读次数:
124
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
分析;
此题是求二叉树的深度,(无所谓最大深度),用递归的方法很容...
分类:
其他好文 时间:
2015-05-14 14:18:49
阅读次数:
117
题目:Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and...
分类:
其他好文 时间:
2015-05-14 13:35:24
阅读次数:
129
题目:Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For ...
分类:
其他好文 时间:
2015-05-14 11:43:09
阅读次数:
129