leetcode
Dev-L
这个作者很懒,什么都没留下…
展开
-
LeetCode 617. Merge Two Binary Trees
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree. T原创 2017-11-03 20:01:32 · 226 阅读 · 0 评论 -
LeetCode 669. Trim a Binary Search Tree
Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree, so the result原创 2017-11-04 11:11:48 · 279 阅读 · 0 评论 -
LeetCode 654. Maximum Binary Tree
Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array. The left subtree is the maximum tree constructed from原创 2017-11-03 19:56:26 · 275 阅读 · 0 评论 -
LeetCode 671. Second Minimum Node In a Binary Tree
Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. If the node has two sub-nodes, then this node’s val原创 2017-11-04 09:54:57 · 279 阅读 · 0 评论 -
LeetCode 404. Sum of Left Leaves
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.刚开始理解错了,原创 2017-11-04 00:06:39 · 258 阅读 · 0 评论 -
LeetCode 513. Find Bottom Left Tree Value
Given a binary tree, find the leftmost value in the last row of the tree.Example 1: Input: 2 / \ 1 3Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 6原创 2017-11-03 22:28:08 · 255 阅读 · 0 评论 -
LeetCode 653. Two Sum IV - Input is a BST
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1: Input: 5 / \ 3 6 / \ \2原创 2017-11-03 21:41:42 · 308 阅读 · 0 评论 -
LeetCode 637. Average of Levels in Binary Tree
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.Example 1: Input: 3 / \ 9 20 / \ 15 7Output: [3, 14.5, 11] Explanation:原创 2017-11-03 21:23:11 · 260 阅读 · 0 评论 -
LeetCode 515. Find Largest Value in Each Tree Row
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]考察: 树的层序遍历/BFS/** * Definition for a binary tree原创 2017-11-03 21:01:21 · 267 阅读 · 0 评论 -
LeetCode 538. Convert BST to Greater Tree
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.Example:I原创 2017-11-04 15:14:04 · 240 阅读 · 0 评论