DFS/BFS
文章平均质量分 88
木头不是哑巴
这个作者很懒,什么都没留下…
展开
-
72. Edit Distance
Given two stringsword1andword2, returnthe minimum number of operations required to convertword1toword2.You have the following three operations permitted on a word:Insert a character Delete a character Replace a characterExample 1:Input:...原创 2021-05-29 18:34:28 · 180 阅读 · 0 评论 -
337. House Robber III
337. House Robber IIIThe thief has found himself a new place for his thievery again. There is only one entrance to this area, calledroot.Besides theroot, each house has one and only one parent house. After a tour, the smart thief realized that all ho..原创 2021-04-23 23:10:34 · 123 阅读 · 0 评论 -
124. Binary Tree Maximum Path Sum
124.Binary Tree Maximum Path SumApathin a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequenceat most once. Note that the path does not need to pass t...原创 2021-04-23 00:04:53 · 146 阅读 · 0 评论 -
576. Out of Boundary Paths
576. Out of Boundary PathsThere is anmbyngrid with a ball. Given the start coordinate(i,j)of the ball, you can move the ball toadjacentcell or cross the grid boundary in four directions (up, down, left, right). However, you canat mostmoveNtim...转载 2020-08-13 01:03:03 · 118 阅读 · 0 评论 -
332. Reconstruct Itinerary
332.Reconstruct ItineraryGiven a list of airline tickets represented by pairs of departure and arrival airports[from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs fromJFK. Thus, the itinerary must begin with...转载 2020-08-08 00:28:56 · 135 阅读 · 0 评论 -
1530. Number of Good Leaf Nodes Pairs
1530. Number of Good Leaf Nodes PairsGiven therootof a binary tree and an integerdistance. A pair of two differentleafnodes of a binary tree is said to be good if the length ofthe shortest pathbetween them is less than or equal todistance.Retur...原创 2020-08-06 23:54:46 · 220 阅读 · 0 评论 -
55. Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are able to reach the last index.Example 1:Inp.转载 2020-07-04 12:41:30 · 119 阅读 · 0 评论 -
39. Combination Sum
Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamerepeated number may be chosen fromcandidatesunlimited number...转载 2020-07-04 09:38:13 · 145 阅读 · 0 评论 -
LeetCode:127 Word Ladder
Given 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 ti...转载 2019-12-17 23:59:35 · 117 阅读 · 0 评论 -
Leetcode 236. Lowest Common Ancestor of a Binary Tree
Given 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 p...转载 2020-01-04 21:58:16 · 95 阅读 · 0 评论 -
LeetCode 210: Course Schedule II
There are a total ofncourses you have to take, labeled from0ton-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...原创 2019-12-15 23:14:50 · 121 阅读 · 0 评论