摘要: SubsetsGiven a set of distinct integers, return all possible subsets.ExampleIfS=[1,2,3], a solution is:[ [3], [1], [2], [1,2,3], [1,3], [2,3], ... 阅读全文
posted @ 2015-10-28 22:50 Tri_tri_tri 阅读(247) 评论(0) 推荐(0)
摘要: Search Range in Binary Search TreeGiven two values k1 and k2 (where k1 k2 也就是说这个指针已经出了给定的条件了,这时候就没必要再往这个方向DFS了,再往下走结果也不会满足条件了。再仔细的说一下,就是,只有在rootk2的时候... 阅读全文
posted @ 2015-10-08 00:21 Tri_tri_tri 阅读(138) 评论(0) 推荐(0)
摘要: Binary Tree Zigzag Level Order TraversalGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then... 阅读全文
posted @ 2015-10-07 23:54 Tri_tri_tri 阅读(166) 评论(0) 推荐(0)
摘要: Binary Tree Level Order Traversal IGiven a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).... 阅读全文
posted @ 2015-10-07 12:06 Tri_tri_tri 阅读(140) 评论(0) 推荐(0)
摘要: Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.ExampleGiven the below b... 阅读全文
posted @ 2015-10-07 11:13 Tri_tri_tri 阅读(161) 评论(0) 推荐(0)
摘要: Lowest Common Ancestor Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes. The lowest common ancesto 阅读全文
posted @ 2015-10-07 07:23 Tri_tri_tri 阅读(225) 评论(0) 推荐(0)
摘要: Inorder Successor in BSTGiven a binary search tree and a node in it, find the in-order successor of that node in the BST.ExampleGiven tree =[2,1]and n... 阅读全文
posted @ 2015-10-07 02:12 Tri_tri_tri 阅读(419) 评论(0) 推荐(0)
摘要: Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre... 阅读全文
posted @ 2015-10-07 00:07 Tri_tri_tri 阅读(137) 评论(0) 推荐(0)
摘要: Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre... 阅读全文
posted @ 2015-10-06 12:18 Tri_tri_tri 阅读(153) 评论(0) 推荐(0)
摘要: Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ... 阅读全文
posted @ 2015-10-06 11:57 Tri_tri_tri 阅读(157) 评论(0) 推荐(0)