
LeetCode--Tree
天天天青
这个作者很懒,什么都没留下…
展开
-
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. ...原创 2018-02-27 16:28:38 · 310 阅读 · 0 评论 -
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 re...原创 2018-02-27 16:31:54 · 346 阅读 · 0 评论 -
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:T...原创 2018-02-27 16:37:45 · 299 阅读 · 0 评论 -
Binary Tree Preorder Traversal(二叉树前序遍历)
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,2,3]./** * Definition for a binary tree node....原创 2018-02-28 10:30:00 · 227 阅读 · 0 评论