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) 编辑

导航