题目:
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
/ 2 3
思路:刚开始思路...
分类:
其他好文 时间:
2015-04-09 11:52:49
阅读次数:
107
题目:
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
...
分类:
其他好文 时间:
2015-04-09 10:38:07
阅读次数:
128
与前面的先序遍历相似。此题为后序遍历。C++: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *rig...
分类:
其他好文 时间:
2015-04-08 23:23:14
阅读次数:
159
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 /3return [1,2,3].可用递归,进行。也可以用迭代...
分类:
其他好文 时间:
2015-04-08 23:04:50
阅读次数:
157
用xftp传送文件时,需要输入ip地址,可连通的端口号,采用sftp协议输入数据库传送,属性binary,二进制上传文件,图片中文名称正常显示等,需要该属性支持UTF-8
分类:
其他好文 时间:
2015-04-08 22:47:46
阅读次数:
158
思路:
按层序遍历的思路,每次只保存该层的最后一个元素即可。...
分类:
其他好文 时间:
2015-04-08 21:37:11
阅读次数:
118
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-04-08 21:10:38
阅读次数:
108
题目:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 ...
分类:
其他好文 时间:
2015-04-08 18:14:31
阅读次数:
111
题目:
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
1 ...
分类:
其他好文 时间:
2015-04-08 18:10:34
阅读次数:
132
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 example:
Given binary ...
分类:
其他好文 时间:
2015-04-08 15:07:05
阅读次数:
161