tree
你看见我的代码了么
愿世界没有bug
展开
-
[leetcode]437. Path Sum III
[leetcode]437. Path Sum IIIAnalysis everyday is the first day of your rest life—— [间歇性迷茫+1~]You are given a binary tree in which each node contains an integer value. Find the number of pa...原创 2018-06-21 16:12:58 · 89 阅读 · 0 评论 -
[leetcode]814. Binary Tree Pruning
[leetcode]814. Binary Tree PruningAnalysis 周四不知道快不快乐—— [有点想回家过暑假的冲动!]We are given the head node root of a binary tree, where additionally every node’s value is either a 0 or a 1. Return t...原创 2018-08-02 17:29:49 · 105 阅读 · 0 评论 -
[leetcode]526. Beautiful Arrangement
[leetcode]526. Beautiful ArrangementAnalysis 虚惊一场~—— [好好养生!!]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 su...原创 2018-09-04 20:06:04 · 123 阅读 · 0 评论 -
[leetcode]94. Binary Tree Inorder Traversal
[leetcode]94. Binary Tree Inorder TraversalAnalysis 想把拖鞋赛道实验室某男生嘴里!!!—— [生气气]Given a binary tree, return the inorder traversal of its nodes’ values. 中序遍历保存节点值。。。Implement/** * Defi...原创 2018-09-05 14:11:05 · 75 阅读 · 0 评论 -
[leetcode]144. Binary Tree Preorder Traversal
[leetcode]144. Binary Tree Preorder TraversalAnalysis明天就是中秋节了,那就提前拜个早年吧—— [ummm~]Given a binary tree, return the preorder traversal of its nodes’ values.前序遍历二叉树,然后输出节点值。Implement/** * Defin...原创 2018-09-23 21:55:12 · 127 阅读 · 0 评论 -
[leetcode]230. Kth Smallest Element in a BST
[leetcode]230. Kth Smallest Element in a BSTAnalysisummmm—— [每天刷题并不难。。。其实已经很多天没刷了]Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note:You may ...原创 2018-10-10 10:13:51 · 129 阅读 · 0 评论 -
[leetcode]701. Insert into a Binary Search Tree
[leetcode]701. Insert into a Binary Search TreeAnalysis明天要吃柚子—— [每天刷题并不难0.0]Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the...原创 2018-10-19 15:08:02 · 116 阅读 · 0 评论 -
[leetcode]337. House Robber III
[leetcode]337. House Robber IIIAnalysisfighting!!!—— [每天刷题并不难0.0]The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besi...原创 2018-10-22 11:50:04 · 96 阅读 · 0 评论 -
[leetcode]102. Binary Tree Level Order Traversal
[leetcode]102. Binary Tree Level Order TraversalAnalysisummmmmm—— [每天刷题并不难0.0]Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level...原创 2018-10-28 15:55:09 · 75 阅读 · 0 评论 -
[leetcode]623. Add One Row to Tree
[leetcode]623. Add One Row to TreeAnalysis今天要吃柚子—— [每天刷题并不难0.0]Given the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The r...原创 2018-10-21 10:38:03 · 137 阅读 · 0 评论 -
[leetcode]199. Binary Tree Right Side View
[leetcode]199. Binary Tree Right Side ViewAnalysis好冷鸭—— [每天刷题并不难0.0]Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered fr...原创 2018-11-08 14:19:56 · 120 阅读 · 0 评论 -
[leetcode]449. Serialize and Deserialize BST
[leetcode]449. Serialize and Deserialize BSTAnalysis唉 感觉应该GG了,还是好好刷题看论文吧—— [每天刷题并不难0.0]Serialization is the process of converting a data structure or object into a sequence of bits so that it c...原创 2018-12-04 11:36:37 · 91 阅读 · 0 评论 -
[leetcode]863. All Nodes Distance K in Binary Tree
[leetcode]863. All Nodes Distance K in Binary TreeAnalysisnormal day—— [每天刷题并不难0.0]We are given a binary tree (with root node root), a target node, and an integer value K.Return a list of the ...原创 2018-12-18 09:34:02 · 101 阅读 · 0 评论 -
[leetcode]971. Flip Binary Tree To Match Preorder Traversal
[leetcode]971. Flip Binary Tree To Match Preorder TraversalAnalysis昨天和今天天气都很好鸭~嘻嘻—— [每天刷题并不难0.0]Given a binary tree with N nodes, each node has a different value from {1, …, N}.A node in this ...原创 2019-01-18 09:52:48 · 199 阅读 · 0 评论 -
[leetcode]114. Flatten Binary Tree to Linked List
[leetcode]114. Flatten Binary Tree to Linked ListAnalysis努力工作哇—— [每天刷题并不难0.0]Given a binary tree, flatten it to a linked list in-place.Explanation:参考:http://www.cnblogs.com/grandyang/p/42938...原创 2019-02-23 09:50:13 · 118 阅读 · 0 评论 -
[leetcode]103. Binary Tree Zigzag Level Order Traversal
[leetcode]103. Binary Tree Zigzag Level Order TraversalAnalysisfighting—— [每天刷题并不难0.0]Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right,...原创 2019-02-28 09:54:42 · 109 阅读 · 0 评论 -
[leetcode]515. Find Largest Value in Each Tree Row
[leetcode]515. Find Largest Value in Each Tree RowAnalysis 啊啊啊啊啊啊—— [生死有命富贵在天]You need to find the largest value in each row of a binary tree. 层序遍历,然后找到每一层的最大值就行了~Implement方法一(层序遍历)...原创 2018-08-06 20:06:14 · 74 阅读 · 0 评论 -
[leetcode]513. Find Bottom Left Tree Value
[leetcode]513. Find Bottom Left Tree ValueAnalysis 啊啊啊啊啊啊—— [啊啊啊啊 paper结果怎么还不出来,心塞]Given a binary tree, find the leftmost value in the last row of the tree. 层序遍历,每一层取第一个节点值,然后更新~Implem...原创 2018-08-06 19:47:17 · 86 阅读 · 0 评论 -
[leetcode]501. Find Mode in Binary Search Tree
[leetcode]501. Find Mode in Binary Search TreeAnalysis 讨厌的人总是那么讨厌!—— [ummmm~]Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) i...原创 2018-06-29 19:45:59 · 112 阅读 · 0 评论 -
[leetcode]572. Subtree of Another Tree
[leetcode]572. Subtree of Another TreeAnalysis 中午可以吃胡萝卜和肉肉啦~—— [在家就是爽~]Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a ...原创 2018-07-08 11:23:25 · 89 阅读 · 0 评论 -
[leetcode]530. Minimum Absolute Difference in BST
[leetcode]530. Minimum Absolute Difference in BSTAnalysis 盗将行好听~—— [嘻嘻~]Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two ...原创 2018-07-02 15:42:49 · 69 阅读 · 0 评论 -
[leetcode]538. Convert BST to Greater Tree
[leetcode]538. Convert BST to Greater TreeAnalysis 盗将行好听~—— [嘻嘻~]Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the or...原创 2018-07-02 21:54:18 · 91 阅读 · 0 评论 -
[leetcode]653. Two Sum IV - Input is a BST
[leetcode]653. Two Sum IV - Input is a BSTAnalysis ummmm~—— [ummmm~]Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum i...原创 2018-07-16 14:46:02 · 127 阅读 · 0 评论 -
[leetcode]671. Second Minimum Node In a Binary Tree
[leetcode]671. Second Minimum Node In a Binary TreeAnalysis 嘻嘻~—— [嘻嘻~]Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree h...原创 2018-07-17 10:45:33 · 108 阅读 · 0 评论 -
[leetcode]543. Diameter of Binary Tree
[leetcode]543. Diameter of Binary TreeAnalysis blue~—— [blue~]Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length o...原创 2018-07-04 16:26:53 · 110 阅读 · 0 评论 -
[leetcode]606. Construct String from Binary Tree
[leetcode]606. Construct String from Binary TreeAnalysis ummm~—— [ummmm~]You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing...原创 2018-07-11 21:11:32 · 89 阅读 · 0 评论 -
[leetcode]617. Merge Two Binary Trees
[leetcode]617. Merge Two Binary TreesAnalysis 西红柿放冰柜都有人拿。。。—— [素质十八连]Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are ov...原创 2018-07-12 10:21:02 · 115 阅读 · 0 评论 -
[leetcode]563. Binary Tree Tilt
[leetcode]563. Binary Tree TiltAnalysis 中午吃啥?—— [明天要回家啦,嘻嘻~]Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between t...原创 2018-07-05 17:30:03 · 87 阅读 · 0 评论 -
[leetcode]687. Longest Univalue Path
[leetcode]687. Longest Univalue PathAnalysis ummmm~—— [ummmm~]Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may ...原创 2018-07-19 20:27:43 · 85 阅读 · 0 评论 -
[leetcode]637. Average of Levels in Binary Tree
[leetcode]637. Average of Levels in Binary TreeAnalysis 周五啦~—— [嘻嘻~]Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. 显然用BFS解决~...原创 2018-07-13 20:37:14 · 91 阅读 · 0 评论 -
[leetcode]700. Search in a Binary Search Tree
[leetcode]700. Search in a Binary Search TreeAnalysis 一个有台风的周末~—— [中午吃什么外卖呢~]Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the no...原创 2018-07-22 11:17:10 · 354 阅读 · 0 评论 -
[leetcode]654. Maximum Binary Tree
[leetcode]654. Maximum Binary TreeAnalysis 周二快乐~—— [ummm~]Given an integer array with no duplicates. A maximum tree building on this array is defined as follow: The root is the maximum nu...原创 2018-07-31 21:02:48 · 132 阅读 · 0 评论 -
[leetcode]872. Leaf-Similar Trees
[leetcode]872. Leaf-Similar TreesAnalysis old friends~—— [嘻嘻~]Consider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf value sequence. 直...原创 2018-07-27 19:21:31 · 310 阅读 · 1 评论 -
[leetcode]662. Maximum Width of Binary Tree
[leetcode]662. Maximum Width of Binary TreeAnalysisHappy girls day—— [每天刷题并不难0.0]Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the max...原创 2019-03-07 13:30:55 · 196 阅读 · 0 评论