When prototyping (or even finalizing) data structures such as trees, it can be useful to have a flexible class that will allow you to specify arbitrar...
分类:
编程语言 时间:
2015-04-21 22:13:28
阅读次数:
144
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 al...
分类:
其他好文 时间:
2015-04-21 22:08:41
阅读次数:
165
题目来自于leetcode
https://leetcode.com/problems/path-sum/
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the ...
分类:
其他好文 时间:
2015-04-21 18:05:43
阅读次数:
156
https://leetcode.com/problems/powx-n/Implement pow(x,n).解题思路:这种math的题目本来就不擅长,看到题目tag里有binary search,很是疑问,不知道怎么解。直接写网友的思路吧,其实就是递归。对幂数n折半递归,递归结束的条件为n达到0...
分类:
其他好文 时间:
2015-04-21 17:58:31
阅读次数:
116
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-04-21 17:55:03
阅读次数:
104
由于工作中需要将二进制文件数据转换成C数组,于是写了这个工具(bin2c),代码如你所见,只有看上去不多的几行.
分类:
其他好文 时间:
2015-04-21 14:20:38
阅读次数:
125
problem:
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.
Hide Tags
Tr...
分类:
其他好文 时间:
2015-04-21 11:20:10
阅读次数:
108
题目:
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010...
分类:
其他好文 时间:
2015-04-21 11:11:36
阅读次数:
128
uva 11008 Antimatter Ray ClearcuttingIt’s year 2465, and you are the Chief Engineer for Glorified Lumberjacks Inc. on planet Trie. There is a number of trees that you need to cut down, and the only wea...
分类:
其他好文 时间:
2015-04-21 09:45:12
阅读次数:
194
problem:
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For exa...
分类:
其他好文 时间:
2015-04-21 09:37:25
阅读次数:
266