题目:
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:
Give...
分类:
编程语言 时间:
2015-07-09 17:59:13
阅读次数:
112
Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth
smallest element in it.
Note:
You may assume k is always valid, 1 ≤ k ≤ BST's to...
分类:
其他好文 时间:
2015-07-09 14:40:05
阅读次数:
122
解法一:非递归 1 vector preorderTraversal(TreeNode* root) 2 { 3 vector res; 4 if (root == NULL) 5 return res; 6 7 stack node_stack; 8 ...
分类:
其他好文 时间:
2015-07-09 13:09:15
阅读次数:
103
Binary Tree Preorder Traversal 题目链接 题目要求: Given a binary tree, return thepreordertraversal of its nodes' values. For example: Given binary tree{1...
分类:
其他好文 时间:
2015-07-09 13:04:42
阅读次数:
91
https://leetcode.com/problems/minimum-depth-of-binary-tree/ 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 ...
分类:
其他好文 时间:
2015-07-09 12:50:40
阅读次数:
102
https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLi.....
分类:
其他好文 时间:
2015-07-09 12:46:18
阅读次数:
91
Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the ...
分类:
其他好文 时间:
2015-07-09 12:41:13
阅读次数:
103
题目:
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].
解题:
递归的还是和前面中...
分类:
编程语言 时间:
2015-07-09 11:16:06
阅读次数:
179
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:
1...
分类:
其他好文 时间:
2015-07-08 22:41:17
阅读次数:
187
题目链接 题目要求: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree i...
分类:
其他好文 时间:
2015-07-08 22:28:32
阅读次数:
167