上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页

2014年9月2日

Generate Parentheses

摘要: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: " 阅读全文

posted @ 2014-09-02 09:58 bug睡的略爽 阅读(392) 评论(0) 推荐(0) 编辑

2014年8月28日

Symmetric Tree

摘要: 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 / \ 2 2 / 阅读全文

posted @ 2014-08-28 19:49 bug睡的略爽 阅读(131) 评论(0) 推荐(0) 编辑

Validate Binary Search Tree

摘要: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文

posted @ 2014-08-28 19:38 bug睡的略爽 阅读(126) 评论(0) 推荐(0) 编辑

Recover Binary Search Tree

摘要: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) space i 阅读全文

posted @ 2014-08-28 18:31 bug睡的略爽 阅读(217) 评论(0) 推荐(0) 编辑

Subsets系列

摘要: Subsets Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set 阅读全文

posted @ 2014-08-28 17:05 bug睡的略爽 阅读(186) 评论(0) 推荐(0) 编辑

2014年8月27日

Convert Sorted Array to Binary Search Tree & Convert Sorted List to Binary Search Tree

摘要: Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 方法:将有序数组转 阅读全文

posted @ 2014-08-27 22:14 bug睡的略爽 阅读(145) 评论(0) 推荐(0) 编辑

2014年8月26日

Balanced Binary Tree

摘要: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文

posted @ 2014-08-26 17:15 bug睡的略爽 阅读(144) 评论(0) 推荐(0) 编辑

Minimum Depth of Binary Tree & Maximum Depth of Binary Tree

摘要: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文

posted @ 2014-08-26 16:47 bug睡的略爽 阅读(119) 评论(0) 推荐(0) 编辑

Flatten Binary Tree to Linked List

摘要: Flatten Binary Tree to Linked List Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tr 阅读全文

posted @ 2014-08-26 16:30 bug睡的略爽 阅读(126) 评论(0) 推荐(0) 编辑

Path Sum系列

摘要: Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the giv 阅读全文

posted @ 2014-08-26 16:23 bug睡的略爽 阅读(170) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页

导航