
二叉树
文章平均质量分 69
sscssz
这个作者很懒,什么都没留下…
展开
-
[81][E][leetcode 题解]Minimum Depth of Binary Tree
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 nearest leaf node.Subscribe to see which c原创 2015-12-09 23:28:17 · 381 阅读 · 0 评论 -
【LeetCode】508. Most Frequent Subtree Sum【M】【40】
Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (includi原创 2017-02-22 13:34:02 · 570 阅读 · 0 评论 -
【LeetCode】515. Find Largest Value in Each Tree Row【E】【87】
You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]Subsc原创 2017-02-19 18:37:01 · 1305 阅读 · 0 评论 -
【LeetCode】513. Find Bottom Left Tree Value【M】【73】
Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \ 2 3原创 2017-02-18 13:19:05 · 984 阅读 · 0 评论 -
【leetcode】404. Sum of Left Leaves【E】
Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24原创 2016-09-26 21:23:25 · 1336 阅读 · 0 评论 -
【leetcode】257. Binary Tree Paths【E】【94】
Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]Cr原创 2016-09-04 22:39:12 · 372 阅读 · 0 评论 -
106. Construct Binary Tree from Inorder and Postorder Traversal【M】【31】
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Subscribe to see which companies asked this原创 2016-06-07 15:13:21 · 348 阅读 · 0 评论 -
105. Construct Binary Tree from Preorder and Ignorer Traversal【M】【35】【再来一遍】
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Subscribe to see which companies asked this q原创 2016-06-07 14:58:21 · 567 阅读 · 0 评论 -
337. House Robber III 【M】【vip】
The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour原创 2016-05-11 20:43:18 · 424 阅读 · 0 评论 -
109. Convert Sorted List to Binary Search Tree【M】【33】【leetcode题解】
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.Subscribe to see which companies asked this question从给定的有序链表生成平衡二叉树。解原创 2016-02-23 15:24:41 · 440 阅读 · 0 评论 -
【M】【83】【leetcode题解】Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1原创 2015-12-11 20:48:36 · 356 阅读 · 0 评论 -
103. Binary Tree Zigzag Level Order Traversal【M】
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 and alternate between).For example:Given binary原创 2017-03-29 10:09:58 · 431 阅读 · 0 评论