摘要: 题目: Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution 阅读全文
posted @ 2015-04-18 15:19 YRB 阅读(1159) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to it 阅读全文
posted @ 2015-04-18 14:03 YRB 阅读(1239) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the o... 阅读全文
posted @ 2015-04-18 14:02 YRB 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: click to show hints. Hints: If y 阅读全文
posted @ 2015-04-18 14:01 YRB 阅读(677) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. return 链接: http://leetcode.com/problems/pat 阅读全文
posted @ 2015-04-18 13:59 YRB 阅读(609) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 given su 阅读全文
posted @ 2015-04-18 13:58 YRB 阅读(696) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 neare 阅读全文
posted @ 2015-04-18 13:57 YRB 阅读(1275) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2015-04-18 13:56 YRB 阅读(768) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 链接: http://leetcode.com/problems/con 阅读全文
posted @ 2015-04-18 13:54 YRB 阅读(1363) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 链接: http://leetcode.com/problems/convert-sorted- 阅读全文
posted @ 2015-04-18 13:51 YRB 阅读(1076) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). 阅读全文
posted @ 2015-04-18 13:47 YRB 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 题目: Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 链接: http 阅读全文
posted @ 2015-04-18 13:46 YRB 阅读(596) 评论(0) 推荐(0) 编辑
摘要: 题目: Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 链接: http: 阅读全文
posted @ 2015-04-18 13:41 YRB 阅读(607) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthe 阅读全文
posted @ 2015-04-18 13:40 YRB 阅读(902) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level 阅读全文
posted @ 2015-04-18 13:39 YRB 阅读(437) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tre 阅读全文
posted @ 2015-04-18 13:38 YRB 阅读(418) 评论(0) 推荐(1) 编辑
摘要: 题目: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the 阅读全文
posted @ 2015-04-18 12:24 YRB 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 题目: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identic 阅读全文
posted @ 2015-04-18 12:23 YRB 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 题目: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 ... 阅读全文
posted @ 2015-04-18 12:22 YRB 阅读(631) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: 链接:http://leetcode.com/problems/vali 阅读全文
posted @ 2015-04-18 12:21 YRB 阅读(1096) 评论(0) 推荐(0) 编辑