摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 分析: 根据一个有序链表,得到一个平衡二叉搜索树,主要是根据快慢指针得到链表的中 阅读全文
posted @ 2016-11-12 21:08 WillWu 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Path Sum II 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 阅读全文
posted @ 2016-11-12 20:01 WillWu 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of a tree, construct the binary tree. 根据后序遍历和中序遍历构建一棵 阅读全文
posted @ 2016-11-12 15:09 WillWu 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a tree, construct the binary tree. 分析: 根据前序遍历和中序遍历构造 阅读全文
posted @ 2016-11-12 15:01 WillWu 阅读(166) 评论(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 sub 阅读全文
posted @ 2016-11-12 12:27 WillWu 阅读(131) 评论(0) 推荐(0) 编辑