摘要: The problem:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree,... 阅读全文
posted @ 2015-01-11 00:02 airforce 阅读(164) 评论(0) 推荐(0) 编辑
摘要: The problem:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2... 阅读全文
posted @ 2015-01-10 12:01 airforce 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Problem 1 [Balanced Binary Tree]Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as ... 阅读全文
posted @ 2015-01-10 04:39 airforce 阅读(175) 评论(0) 推荐(0) 编辑
摘要: The problem:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",r... 阅读全文
posted @ 2015-01-10 00:20 airforce 阅读(209) 评论(0) 推荐(0) 编辑
摘要: The problem:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.My analysis:The problem is easy at some extent,... 阅读全文
posted @ 2015-01-09 11:10 airforce 阅读(212) 评论(0) 推荐(0) 编辑
摘要: The problem:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(... 阅读全文
posted @ 2015-01-09 01:30 airforce 阅读(118) 评论(0) 推荐(0) 编辑
摘要: The problem: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 con... 阅读全文
posted @ 2015-01-08 23:44 airforce 阅读(343) 评论(0) 推荐(0) 编辑
摘要: The problem:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My... 阅读全文
posted @ 2015-01-08 11:59 airforce 阅读(182) 评论(0) 推荐(0) 编辑
摘要: The problem:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My ... 阅读全文
posted @ 2015-01-08 10:53 airforce 阅读(150) 评论(0) 推荐(0) 编辑
摘要: The problem:Convert Sorted List to Binary Search TreeLink:https://oj.leetcode.com/problems/convert-sorted-list-to-binary-search-tree/My analysis:The i... 阅读全文
posted @ 2015-01-08 00:53 airforce 阅读(164) 评论(0) 推荐(0) 编辑