![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
zyp7355
这个作者很懒,什么都没留下…
展开
-
leetcode#116 Populating Next Right Pointers in Each Node
You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node {int val;Node *left;Node *ri...原创 2020-02-29 05:25:42 · 79 阅读 · 0 评论 -
leetcode #114. Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place.For example, given the following tree:1/ 2 5/ \ 3 4 6The flattened tree should look like:123456知识点stack 先进先出pop ...原创 2020-02-28 13:49:42 · 78 阅读 · 0 评论 -
leetcode#113. Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.Note: A leaf is a node with no children.Example:Given the below binary tree and sum = 22, 5 ...原创 2020-02-28 04:19:27 · 89 阅读 · 0 评论 -
leetcode #111. 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.Note: A leaf is a node with no children....原创 2020-02-27 07:45:25 · 87 阅读 · 0 评论 -
leetcode#110. Balanced Binary Tree
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 left and right subtrees of every node differ in heigh...原创 2020-02-27 06:48:14 · 85 阅读 · 0 评论 -
leetcode#109. Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which the d...原创 2020-02-26 13:47:17 · 67 阅读 · 0 评论 -
leetcode#108. Convert Sorted Array to Binary Search Tree
二分查找中的问题循环条件为什么不是 (l<r)第一,如果数组长度为1的话,不管查找什么都会恒定的返回-1,这显然是错的。第二,当l + 1 = r的时候,mid=l,如果此时A[mid]小于target执行l=mid+1=r,再次循环时候while条件不满足,将退出循环,但是A[right]可能==target。考虑[3,5] k=5的情况,这时候会返nick大神讲解看了视频发现了...原创 2020-02-26 07:45:08 · 92 阅读 · 0 评论 -
leetcode#102Binary Tree Level Order Traversal
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 tree [3,9,20,null,null,15,7],3/ 9 20/ 15 7retu...原创 2020-02-26 06:34:22 · 64 阅读 · 0 评论 -
leetcode #107. Binary Tree Level Order Traversal II
Binary Tree Level Order Traversal IIEasy1039186Add to ListShareGiven a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level fro...原创 2020-02-26 06:33:46 · 110 阅读 · 0 评论 -
leetcode#105 Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, givenpreorder = [3,9,20,15,7]inorder = [9,3,15,...原创 2020-02-26 06:00:38 · 63 阅读 · 0 评论 -
leetcode# Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes’ values.Example:Input: [1,null,2,3]12/3Output: [1,3,2]Follow up: Recursive solution is trivial, could you do it iteratively?题意很...原创 2020-02-23 06:39:40 · 65 阅读 · 0 评论