![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeeCode_tree
Haskei
这个作者很懒,什么都没留下…
展开
-
[LeeCode] 733. Flood Fill Easy (Python)
733.Flood FillEasyAnimageis represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).Given a coordinate(sr, sc)representing the starting pixel (row and column) of the flood fill, and a pixe...原创 2020-06-12 14:50:46 · 159 阅读 · 0 评论 -
[LeeCode] 675. Cut Off Trees for Golf Event (Python)
675.Cut Off Trees for Golf EventHardYou are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map:0represents theobstaclecan't be reached. 1represents thegroundcan be walked throu...原创 2020-06-12 14:17:49 · 212 阅读 · 0 评论 -
[LeeCode] 543. Diameter of Binary Tree (Python)
543.Diameter of Binary TreeEasyGiven a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of thelongestpath between any two nodes in a tree. This path may or may not pass through the ...原创 2020-06-12 09:32:46 · 158 阅读 · 0 评论 -
[LeeCode] 236. Lowest Common Ancestor of a Binary Tree (Python)
236.Lowest Common Ancestor of a Binary TreeMediumGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes pan...原创 2020-06-11 16:28:03 · 91 阅读 · 0 评论 -
[LeeCode] 207. Course Schedule (Python)
207.Course ScheduleMediumThere are a total ofnumCoursescourses you have to take, labeled from0tonumCourses-1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair:[0,1]...原创 2020-06-11 13:36:21 · 158 阅读 · 0 评论 -
[LeeCode] 200. Number of Islands (Python) 深搜
200.Number of IslandsMediumGiven a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the g...原创 2020-06-11 09:53:58 · 145 阅读 · 0 评论 -
126. Word Ladder II (python) 单广/ 双广
126.Word Ladder IIHardGiven two words (beginWordandendWord), and a dictionary's word list, find all shortest transformation sequence(s) frombeginWordtoendWord, such that:Only one letter can be changed at a time Each transformed word must exist...原创 2020-06-10 04:59:50 · 252 阅读 · 0 评论 -
[LeeCode] 127. Word Ladder (Python)
127.Word LadderMediumGiven two words (beginWordandendWord), and a dictionary's word list, find the length of shortest transformation sequence frombeginWordtoendWord, such that:Only one letter can be changed at a time. Each transformed word mus...原创 2020-06-07 14:31:12 · 164 阅读 · 0 评论 -
[LeeCode] 124. Binary Tree Maximum Path Sum (Python)
124.Binary Tree Maximum Path SumHardGiven anon-emptybinary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The path mu...原创 2020-06-07 09:31:49 · 138 阅读 · 0 评论 -
[LeeCode] 103. Binary Tree Zigzag Level Order Traversal (Python 层序遍历、先序遍历 )
103.Binary Tree Zigzag Level Order TraversalMediumGiven a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tree...原创 2020-06-07 07:45:05 · 185 阅读 · 0 评论 -
[LeeCode] 98. Validate Binary Search Tree 二叉搜索树
98.Validate Binary Search TreeMediumGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keysless thanthe node's key. The right subtree o...原创 2020-06-07 06:07:10 · 137 阅读 · 0 评论 -
[LeeCode] 102. Binary Tree Level Order Traversal 层次遍历
102.Binary Tree Level Order TraversalMediumGiven a binary tree, return thelevel ordertraversal 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 / \ ...原创 2020-06-06 13:25:23 · 113 阅读 · 0 评论 -
[LeeCode] 101. Symmetric Tree (递归) 平衡二叉树
101.Symmetric TreeEasyGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree[1,2,2,3,4,4,3]is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the following[1,2,2,n...原创 2020-06-06 12:34:25 · 126 阅读 · 0 评论