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
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
BCD码(Binary-Coded Decimal?)亦称二进码十进数或二-十进制代码。用4位二进制数来表示1位十进制数中的0~9这10个数码。是一种二进制的数字编码形式,用二进制编码的十进制代码。BCD码这种编码形式利用了四个位元来储存一个十进制的数码,使二进制和十进制之间的转换得以快捷的进行。这...
分类:
其他好文 时间:
2015-04-21 09:26:33
阅读次数:
137
一、 题目
给你一个二叉树,假设几就站在树的后边,那么此时你就只能看到最右边的节点了。
例如:
1
/ 2 3
\ 5 4
返回值就是[1,3,4]
二、 分析
对于树的遍历,我们通常会使用DFS或BFS,这个题目其实同样是遍历,不过呢,我们只记录下来...
分类:
其他好文 时间:
2015-04-21 00:27:25
阅读次数:
112