题意:
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursive solution is trivial, could you do it iteratively?...
分类:
其他好文 时间:
2014-11-08 13:41:21
阅读次数:
155
A suffix array is a sorted array of all suffixes of a given string. The definition is similar to Suffix Tree which is compressed trie of all suffixes ...
分类:
其他好文 时间:
2014-11-08 13:38:45
阅读次数:
193
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 given sum.Fo...
分类:
其他好文 时间:
2014-11-08 13:35:55
阅读次数:
144
Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened ...
分类:
其他好文 时间:
2014-11-08 13:25:14
阅读次数:
119
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum ...
分类:
其他好文 时间:
2014-11-08 13:24:56
阅读次数:
171
项目中由于需求设计,数据库中需要一个timestamp时间戳类型的字段来作为区别数据添加和修改的标识。由于timestamp在SQL SERVER 2005数据库中,不可为空的timestamp类型在语义上等同于binary(8)类型,可为空的 timestamp类型在语义上等同于varbinary...
分类:
其他好文 时间:
2014-11-08 11:55:14
阅读次数:
231
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution stil...
分类:
其他好文 时间:
2014-11-08 11:43:47
阅读次数:
190
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 ...
分类:
其他好文 时间:
2014-11-08 08:11:54
阅读次数:
244
1 struct SBT{ 2 int treeCnt, root; 3 struct tnode{int data, lc, rc, size;} tree[maxn]; 4 inline void clear(){treeCnt = 0; root = 0;} ...
分类:
其他好文 时间:
2014-11-08 07:06:48
阅读次数:
299
An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all codes are in binary, ...
分类:
其他好文 时间:
2014-11-08 07:05:41
阅读次数:
159