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.
confused what “{1,#,...
分类:
其他好文 时间:
2015-06-25 01:25:38
阅读次数:
143
1. Question求二叉树的最大深度。Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node do...
分类:
其他好文 时间:
2015-06-25 00:00:30
阅读次数:
281
1. Question判断一个二叉树是否是对称的。Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree i...
分类:
其他好文 时间:
2015-06-24 23:54:40
阅读次数:
183
1. Question判断一个树是否是平衡二叉树(每个节点的两个子树深度差不超过1)Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is d...
分类:
其他好文 时间:
2015-06-24 23:54:40
阅读次数:
124
#104 Maximum Depth of Binary Tree
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...
分类:
其他好文 时间:
2015-06-24 22:38:28
阅读次数:
164
1. Question给定两个二叉树,判断是不是相同(结构相同,值相同)的树。Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equa...
分类:
其他好文 时间:
2015-06-24 22:30:31
阅读次数:
148
QuestionGiven a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example:
Given binary tree {3,9,20,#,#,15,7}, 3
/ 9 20
/...
分类:
其他好文 时间:
2015-06-24 16:30:04
阅读次数:
97
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 1
\ ...
分类:
其他好文 时间:
2015-06-24 16:23:28
阅读次数:
152
#58 Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters '
', return the length of last word in the string.
If the last word does not exist,...
分类:
其他好文 时间:
2015-06-24 16:22:21
阅读次数:
141
问题描述: 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1递归反转:先反转根节点的左子树和右子树 然后再分别反转左子树,右子树各自的下的左子树右子树。依此类推...
分类:
其他好文 时间:
2015-06-24 12:48:24
阅读次数:
111