摘要:
题目: 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 阅读全文
摘要:
题目: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to it 阅读全文
摘要:
题目: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... 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 链接: http://leetcode.com/problems/con 阅读全文
摘要:
题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 链接: http://leetcode.com/problems/convert-sorted- 阅读全文
摘要:
题目: 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). 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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: 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: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 ... 阅读全文
摘要:
题目: 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 阅读全文