Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For exam...
分类:
其他好文 时间:
2015-05-22 11:18:29
阅读次数:
107
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:
其他好文 时间:
2015-05-22 09:22:37
阅读次数:
110
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-05-22 09:22:05
阅读次数:
84
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].解题思...
分类:
其他好文 时间:
2015-05-22 09:20:44
阅读次数:
94
FlattenBinaryTreetoLinkedListTotalAccepted:46999TotalSubmissions:163018MySubmissionsQuestionSolutionGivenabinarytree,flattenittoalinkedlistin-place.Forexample,Given1
/25
/\346Theflattenedtreeshouldlooklike:1
2
3
4
5
6clicktoshowhints.分析:先..
分类:
其他好文 时间:
2015-05-22 01:57:56
阅读次数:
91
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
编程语言 时间:
2015-05-22 01:54:09
阅读次数:
189
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.解题思路:先中序遍历找到mistake,然后替换即可,JAVA实现如下:...
分类:
编程语言 时间:
2015-05-22 01:49:49
阅读次数:
111
Unique Binary Search TreesTotal Accepted:48675Total Submissions:134436My SubmissionsQuestionSolutionGivenn, how many structurally uniqueBST's(binary s...
分类:
其他好文 时间:
2015-05-22 00:24:09
阅读次数:
103
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree. 1 class Solut...
分类:
其他好文 时间:
2015-05-22 00:16:38
阅读次数:
177
题目输入一些结点,要求建立一颗二叉树,这些结点输入方式方式是(value, pos),value代表一个正int型的数,pos是一个仅由L与R组成的字符串,L代表左子树,R代表右子树,LRR代表root(根结点)的左子树的左子树的右子树的根结点,此结点的值即为value。思路:采用一个map来保存结...
分类:
其他好文 时间:
2015-05-22 00:15:13
阅读次数:
171