Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia:...
分类:
其他好文 时间:
2015-12-20 08:12:25
阅读次数:
158
题目解析:(链接)Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree...
分类:
其他好文 时间:
2015-12-19 15:03:46
阅读次数:
111
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 ...
分类:
其他好文 时间:
2015-12-19 13:44:38
阅读次数:
163
题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解法一:双节点public TreeNode sortedListToBST...
分类:
其他好文 时间:
2015-12-19 06:37:24
阅读次数:
171
Given a complete binary tree, count the number of nodes.Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, exc...
分类:
其他好文 时间:
2015-12-19 06:34:20
阅读次数:
142
Given 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 following matr...
分类:
其他好文 时间:
2015-12-19 01:26:02
阅读次数:
200
Flatten Binary Tree to Linked ListTotal Accepted:68105Total Submissions:228885Difficulty:MediumGiven a binary tree, flatten it to a linked list in-pla...
分类:
其他好文 时间:
2015-12-18 16:31:19
阅读次数:
85
Given 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,...
分类:
编程语言 时间:
2015-12-18 10:31:49
阅读次数:
173
Convert Sorted Array to Binary Search TreeTotal Accepted:61516Total Submissions:173462Difficulty:MediumGiven an array where elements are sorted in asc...
分类:
其他好文 时间:
2015-12-18 10:31:00
阅读次数:
123
Binary Tree Zigzag Level Order TraversalTotal Accepted:49079Total Submissions:179977Difficulty:MediumGiven a binary tree, return thezigzag level order...
分类:
其他好文 时间:
2015-12-18 10:26:59
阅读次数:
125