
广度优先搜索
景行cmy
这个作者很懒,什么都没留下…
展开
-
leetcode 924. Minimize Malware Spread
In a network of nodes, each nodeiis directly connected to another nodejif and only ifgraph[i][j] = 1.Some nodesinitialare initially infected by malware. Whenever two nodes are directly conne...原创 2019-09-18 10:43:07 · 178 阅读 · 0 评论 -
leetcode 1125. Smallest Sufficient Team
In a project, you have a list of required skills req_skills,and a list of people. The i-th person people[i]contains a list of skills that person has.Consider a sufficient team: a set of people su...原创 2019-09-09 15:39:17 · 289 阅读 · 0 评论 -
leetcode 854. K-Similar Strings
StringsAandBareK-similar (for some non-negative integerK) if we can swap the positions of two letters inAexactlyKtimes so that the resulting string equalsB.Given two anagramsAandB, ret...原创 2019-08-27 19:50:33 · 157 阅读 · 0 评论 -
leetcode 847. Shortest Path Visiting All Nodes
An undirected, connected graph of N nodes (labeled0, 1, 2, ..., N-1) is given asgraph.graph.length = N, andj != iis in the listgraph[i]exactly once, if and only if nodesiandjare connected....原创 2019-08-27 12:03:16 · 129 阅读 · 0 评论 -
leetcode 818. Race Car
Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.)Your car drives automatically according to a sequence of instructions A (accelerate)...原创 2019-08-26 15:59:51 · 160 阅读 · 0 评论 -
leetcode 815. Bus Routes
We have a list of bus routes. Eachroutes[i]is a bus route that the i-th busrepeats forever. For example ifroutes[0] = [1, 5, 7], this means that the firstbus (0-th indexed) travels in the sequenc...原创 2019-08-26 13:12:57 · 193 阅读 · 0 评论 -
leetcode 749. Contain Virus
A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.The world is modeled as a 2-D array of cells, where0represents uninfected cells, and1represents...原创 2019-08-20 14:04:44 · 241 阅读 · 0 评论 -
leetcode 407 Trapping Rain Water II
Given anm x nmatrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.Note:Bothmandnare le...转载 2019-07-14 17:08:02 · 133 阅读 · 0 评论 -
leetcode 126. Word Ladder II
Given 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 Eac...原创 2019-07-14 14:24:34 · 134 阅读 · 0 评论