题目链接:Same Tree
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-04-14 21:41:41
阅读次数:
140
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
这道题要求根据一个有序的数组建立一棵二叉排序树。利用折半的思想,构造根节点,再递归构造左右子树。递归出口是数组中只含一个元素。TreeNode *sortedArrayToBST(vector &...
分类:
其他好文 时间:
2015-04-14 21:34:22
阅读次数:
98
problem:
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, pr...
分类:
其他好文 时间:
2015-04-14 21:31:46
阅读次数:
149
problem:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
Hide Tags
Array Hash
Table Stack Dynamic
Programmin...
分类:
其他好文 时间:
2015-04-14 16:40:04
阅读次数:
110
在Linux 下搜文件,通常先使用 whereis 或 locate ,如果找不到,才以 find 来搜寻!因为 whereis 与 locate 是利用数据库来搜寻数据,比较省时间!>1 whereis (寻找特定文件)whereis [-bmsu] 文件或目录名-b : 只找 binary...
分类:
系统相关 时间:
2015-04-14 16:10:22
阅读次数:
138
Maximum Depth of Binary TreeTotal Accepted:59837Total Submissions:132940My SubmissionsQuestionSolutionGiven a binary tree, find its maximum depth.The ...
分类:
其他好文 时间:
2015-04-14 16:09:07
阅读次数:
145
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2015-04-14 14:25:32
阅读次数:
123
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next() and...
分类:
其他好文 时间:
2015-04-14 13:01:30
阅读次数:
148
C++STL有好几种查找算法,但是他们的用法上有很多共同的地方:1、除了binary_search的返回值是bool之外(查找的了返回true,否则返回false),其他所有的查找算法返回值都是一个迭代器(查找成功返回目标所在迭代器的位置,否则返回最后一个元素的后一个位置或者说是容器的end())2...
分类:
编程语言 时间:
2015-04-14 12:51:00
阅读次数:
161
Same TreeTotal Accepted:56263Total Submissions:133912My SubmissionsQuestionSolutionGiven two binary trees, write a function to check if they are equal...
分类:
其他好文 时间:
2015-04-14 11:07:01
阅读次数:
110