题目描述:
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
思路:以中右左的...
分类:
其他好文 时间:
2014-11-10 13:53:20
阅读次数:
163
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.这道混合插入有序链...
分类:
其他好文 时间:
2014-11-10 06:27:42
阅读次数:
191
Given a binary tree, a target node in the binary tree, and an integer value k, print all the nodes that are at distance k from the given target node. ...
分类:
其他好文 时间:
2014-11-09 23:30:26
阅读次数:
235
Binary Tree Level Order TraversalGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).Fo...
分类:
其他好文 时间:
2014-11-09 16:26:48
阅读次数:
127
这道题A的略烦Binary Tree Level Order Traversal IIGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right...
分类:
其他好文 时间:
2014-11-09 15:09:19
阅读次数:
238
Given a BST, transform it into greater sum tree where each node contains sum of all nodes greater than that node.自己想的复杂了,其实就是一个反向的inorder。新的值就是前面所有元素的...
分类:
其他好文 时间:
2014-11-09 15:07:49
阅读次数:
186
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:
其他好文 时间:
2014-11-09 06:13:51
阅读次数:
122
Given a very large n-ary tree. Where the root node has some information which it wants to pass to all of its children down to the leaves with the cons...
分类:
其他好文 时间:
2014-11-09 06:13:47
阅读次数:
177
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:
其他好文 时间:
2014-11-08 23:36:00
阅读次数:
202
题意:
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?...
分类:
其他好文 时间:
2014-11-08 19:43:46
阅读次数:
188