自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 [leetcode]993. Cousins in Binary Tree(Python)

[leetcode]993. Cousins in Binary Tree题目描述题目理解解题思路DFSBFSTime题目描述Category:Easy TreeIn a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1.Two nodes of a b...

2020-03-30 11:51:10 273

原创 [leetcode]814. Binary Tree Pruning(Python)

[leetcode]814. Binary Tree Pruning题目描述题目理解解题思路DFSMyMethodTime题目描述Category:Medium TreeWe are given the head node root of a binary tree, where additionally every node’s value is either a 0 or a 1.R...

2020-03-29 10:46:15 198

原创 [leetcode]1022. Sum of Root To Leaf Binary Numbers(Python)

[leetcode]1022. Sum of Root To Leaf Binary Numbers题目描述题目理解解题思路MyMethodTime题目描述Category:Easy TreeGiven a binary tree, each node has value 0 or 1. Each root-to-leaf path represents a binary number ...

2020-03-29 09:24:30 213

原创 [leetcode]701. Insert into a Binary Search Tree(Python)

[leetcode]701. Insert into a Binary Search Tree题目描述题目理解解题思路迭代MyMethodTime题目描述Category:Medium TreeGiven the root node of a binary search tree (BST) and a value to be inserted into the tree, insert ...

2020-03-28 11:53:55 176

原创 [leetcode]965. Univalued Binary Tree(Python)

[leetcode]965. Univalued Binary Tree题目描述题目理解解题思路DFSMyMethodTime题目描述Category:Easy TreeA binary tree is univalued if every node in the tree has the same value.Return true if and only if the given t...

2020-03-28 11:04:47 189

原创 [leetcode]684. Redundant Connection(Python)

[leetcode]684. Redundant Connection题目描述题目理解解题思路并查集Time题目描述Category:Medium TreeIn this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that st...

2020-03-27 17:58:15 236

原创 [leetcode]938. Range Sum of BST(Python)

[leetcode]938. Range Sum of BST题目描述题目理解解题思路递归MyMethodTime题目描述Category:Easy TreeGiven the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclus...

2020-03-27 11:10:01 162

原创 [leetcode]662. Maximum Width of Binary Tree(Python)

[leetcode]662. Maximum Width of Binary Tree题目描述题目理解解题思路层序遍历Time题目描述Category:Medium TreeGiven a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the ...

2020-03-26 12:49:52 250

原创 [leetcode]897. Increasing Order Search Tree(Python)

[leetcode]897. Increasing Order Search Tree题目描述题目理解解题思路中序遍历时修改指针MyMethodTime题目描述Category:Easy TreeGiven a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree i...

2020-03-26 11:23:14 188

原创 [leetcode]654. Maximum Binary Tree(Python)

[leetcode]654. Maximum Binary Tree题目描述题目理解解题思路MyMethodTime题目描述Category:Medium TreeGiven an integer array with no duplicates. A maximum tree building on this array is defined as follow:1.The root ...

2020-03-25 22:14:38 152

原创 [leetcode]872. Leaf-Similar Trees(Python)

[leetcode]872. Leaf-Similar Trees题目描述题目理解解题思路中序遍历前序遍历MyMethodTime题目描述Category:Easy TreeConsider all the leaves of a binary tree. From left to right order, the values of those leaves form a leaf v...

2020-03-25 21:30:27 185

原创 [leetcode]652. Find Duplicate Subtrees(Python)

[leetcode]652. Find Duplicate Subtrees题目描述题目理解解题思路Time题目描述Category:Mediudm TreeGiven a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the ...

2020-03-24 11:06:36 181

原创 [leetcode]700. Search in a Binary Search Tree(Python)

[leetcode]700. Search in a Binary Search Tree题目描述题目理解解题思路递归Time题目描述Category:Easy TreeGiven the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the no...

2020-03-24 10:10:00 396

原创 [leetcode]623. Add One Row to Tree(Python)

[leetcode]Add One Row to Tree题目描述题目理解解题思路递归MyMethodTime题目描述Category:Medium TreeGiven 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 d...

2020-03-23 19:12:22 177

原创 [leetcode]687. Longest Univalue Path(Python)

[leetcode]687. Longest Univalue Path题目描述题目理解解题思路DFSMyMethodTime题目描述Category:Easy TreeGiven a binary tree, find the length of the longest path where each node in the path has the same value. This p...

2020-03-23 11:22:09 202

原创 [leetcode]669. Trim a Binary Search Tree(Python)

[leetcode]669. Trim a Binary Search Tree题目描述题目理解解题思路递归Time题目描述Category:Easy TreeGiven a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements ...

2020-03-22 11:01:25 174

原创 [leetcode]515. Find Largest Value in Each Tree Row(Python)

[leetcode]515. Find Largest Value in Each Tree Row题目描述题目理解解题思路DFSMyMethodTime题目描述Category:Medium TreeYou need to find the largest value in each row of a binary tree.题目理解给定一棵二叉树,找出每一行最大值。解题思路...

2020-03-22 10:09:21 171

原创 [leetcode]653. Two Sum IV - Input is a BST(Python)

[leetcode]653. Two Sum IV - Input is a BST题目描述题目理解解题思路BFSMyMethodTime题目描述Category:Easy TreeGiven a Binary Search Tree and a target number, return true if there exist two elements in the BST such t...

2020-03-21 16:14:58 200

原创 [leetcode]513. Find Bottom Left Tree Value(Python)

[leetcode]513. Find Bottom Left Tree Value题目描述题目理解解题思路DFSMyMethodTime题目描述Category:Medium TreeGiven a binary tree, find the leftmost value in the last row of the tree.题目理解给定一棵二叉树,查找树最底层最左边的值。...

2020-03-21 13:02:46 566

原创 [leetcode]637. Average of Levels in Binary Tree(Python)

[leetcode]637. Average of Levels in Binary Tree题目描述题目理解解题思路DFSBFSMyMethodTime题目描述Category:Easy TreeGiven a non-empty binary tree, return the average value of the nodes on each level in the form of...

2020-03-20 13:47:52 207

原创 [leetcode]508. Most Frequent Subtree Sum(Python)

[leetcode]508. Most Frequent Subtree Sum题目描述题目理解解题思路后序遍历+递归MyMethodTime题目描述Category:Medium TreeGiven the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a n...

2020-03-20 12:31:39 197

原创 [leetcode]450.Delete Node in a BST(Python)

[leetcode]450.Delete Node in a BST题目描述题目理解解题思路迭代MyMethod代码分析Time题目描述Category:Medium TreeGiven a root node reference of a BST and a key, delete the node with the given key in the BST. Return the ro...

2020-03-18 22:45:09 146

原创 [leetcode]543.Diameter of Binary Tree(Python)

[leetcode543]Diameter of Binary Tree题目描述题目理解解题思路递归代码分析Time题目描述Category:Easy TreeGiven a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is th...

2020-03-16 23:22:45 162

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除