🕸️
Graphs
Grid BFS/DFS, topo sort, shortest paths, connectivity.
01
Grid islands
0/16 of 23Number of islands, area, flood fill, regions.
○Island PerimeterSilver · 1050○Max Area of IslandSilver · 1100○Flood FillSilver · 1150○As Far From Land As PossibleSilver · 1150○Rotting OrangesSilver · 1200○Number of Connected ComponentsGold · 1300○Count EnclavesGold · 1400○01 MatrixGold · 1400○Count Closed IslandsGold · 1400○Number of IslandsGold · 1450○Walls and GatesGold · 1450○Number of Closed IslandsGold · 1450○Surrounded RegionsGold · 1450○01 Matrix DistancesGold · 1450○Number of EnclavesGold · 1480○Connecting the NetworkGold · 1500+ 7 more in the arena →
02
Topological sort
0/13Course schedule, ordering, safe states.
○Course Schedule: Can FinishSilver · 1150○Topological Sort (Smallest First)Gold · 1400○Find Eventual Safe StatesGold · 1400○Course Schedule II: OrderGold · 1400○Course ScheduleGold · 1450○Course Schedule IIGold · 1450○Find Eventual Safe NodesGold · 1450○Reconstruct ItineraryGold · 1450○Alien Dictionary OrderGold · 1500○Topological Order Smallest FirstGold · 1500○Minimum Height TreesGold · 1550○Alien DictionaryPlatinum · 1750○Sort Items by GroupsDiamond · 1900
03
Shortest paths
0/16 of 24Dijkstra, Bellman-Ford, network delay.
○Dijkstra Shortest DistanceSilver · 1150○Dijkstra Shortest DistancesSilver · 1150○Minimum Genetic MutationSilver · 1200○Shortest Path in a GridGold · 1350○Shortest Path (Unweighted)Gold · 1400○Open The LockGold · 1400○Shortest Path in Unweighted GraphGold · 1400○Network Delay TimeGold · 1450○Shortest Path With Obstacle EliminationGold · 1450○Word Ladder LengthGold · 1450○Jump Game IVGold · 1500○Snakes And LaddersGold · 1500○Shortest Path With Alternating ColorsGold · 1500○Cheapest Flights Within K StopsGold · 1550○Bellman-Ford With Negative EdgesGold · 1550○Number of Ways to Arrive at DestinationGold · 1550+ 8 more in the arena →
04
Connectivity & union-find
0/16Provinces, path exists, redundant edge.
○Find the Town JudgeSilver · 1100○Count Connected ComponentsSilver · 1100○Valid Path ExistsSilver · 1100○Number of ProvincesSilver · 1150○Find if Path ExistsSilver · 1150○Connected Components in a GraphSilver · 1250○Keys and RoomsGold · 1300○Find if Path Exists in GraphGold · 1300○Graph Valid TreeGold · 1350○Redundant ConnectionGold · 1450○Accounts Merge CountGold · 1500○Count Complete ComponentsGold · 1500○Coloring a BorderGold · 1520○Count the Number of Complete ComponentsPlatinum · 1600○Count Complete Connected ComponentsPlatinum · 1750○Count Strongly Connected ComponentsPlatinum · 1850
05
Bipartite & traversal
0/16 of 17Bipartite checks, clone, all paths.
○Find Center of Star GraphSilver · 1100○Count Reachable NodesSilver · 1150○Find the CelebritySilver · 1150○Clone Graph Node CountGold · 1300○Reachable Node CountGold · 1300○All Paths From Source to TargetGold · 1400○Minimum Cost To Connect All PointsGold · 1450○Is Graph BipartiteGold · 1500○Minimum Spanning Tree WeightGold · 1500○Possible BipartitionGold · 1500○Find The City With Fewest ReachableGold · 1500○Is Graph Bipartite?Gold · 1500○Maximal Network RankGold · 1520○Count Unreachable Pairs of NodesGold · 1540○Reachable Nodes In Subdivided GraphGold · 1550○Evaluate DivisionPlatinum · 1700+ 1 more in the arena →