Graph | LeetCode Problems

99 Graph solutions to LeetCode solutions.

Graph Problems View all solutions →

Clone Graph

#133 Medium

Course Schedule

#207 Medium

Course Schedule II

#210 Medium

Minimum Height Trees

#310 Medium

Longest Increasing Path in a Matrix

#329 Hard

Reconstruct Itinerary

#332 Hard

Evaluate Division

#399 Medium

Number of Provinces

#547 Medium

Redundant Connection

#684 Medium

Redundant Connection II

#685 Hard

Network Delay Time

#743 Medium

Cracking the Safe

#753 Hard

Couples Holding Hands

#765 Hard

Is Graph Bipartite?

#785 Medium

Cheapest Flights Within K Stops

#787 Medium

All Paths From Source to Target

#797 Medium

Find Eventual Safe States

#802 Medium

Sum of Distances in Tree

#834 Hard

Keys and Rooms

#841 Medium

Shortest Path Visiting All Nodes

#847 Hard

Loud and Rich

#851 Medium

Reachable Nodes In Subdivided Graph

#882 Hard

Possible Bipartition

#886 Medium

Cat and Mouse

#913 Hard

Minimize Malware Spread

#924 Hard

Minimize Malware Spread II

#928 Hard

Most Stones Removed with Same Row or Column

#947 Medium

Satisfiability of Equality Equations

#990 Medium

Find the Town Judge

#997 Easy

Flower Planting With No Adjacent

#1042 Medium

Shortest Path with Alternating Colors

#1129 Medium

Critical Connections in a Network

#1192 Hard

Sort Items by Groups Respecting Dependencies

#1203 Hard

Maximum Candies You Can Get from Boxes

#1298 Hard

Get Watched Videos by Your Friends

#1311 Medium

Number of Operations to Make Network Connected

#1319 Medium

Find the City With the Smallest Number of Neighbors at a Threshold Distance

#1334 Medium

Validate Binary Tree Nodes

#1361 Medium

Minimum Cost to Make at Least One Valid Path in a Grid

#1368 Hard

Frog Position After T Seconds

#1377 Hard

Course Schedule IV

#1462 Medium

Reorder Routes to Make All Paths Lead to the City Zero

#1466 Medium

Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree

#1489 Hard

Parallel Courses II

#1494 Hard

Path with Maximum Probability

#1514 Medium

Minimum Number of Vertices to Reach All Nodes

#1557 Medium

Remove Max Number of Edges to Keep Graph Fully Traversable

#1579 Hard

Min Cost to Connect All Points

#1584 Medium

Strange Printer II

#1591 Hard

Maximal Network Rank

#1615 Medium

Rank Transform of a Matrix

#1632 Hard

Checking Existence of Edge Length Limited Paths

#1697 Hard

Number Of Ways To Reconstruct A Tree

#1719 Hard

Cat and Mouse II

#1728 Hard

Minimum Degree of a Connected Trio in a Graph

#1761 Hard

Count Pairs Of Nodes

#1782 Hard

Number of Restricted Paths From First to Last Node

#1786 Medium

Find Center of Star Graph

#1791 Easy

Largest Color Value in a Directed Graph

#1857 Hard

Count Ways to Build Rooms in an Ant Colony

#1916 Hard

Minimum Cost to Reach Destination in Time

#1928 Hard

Find if Path Exists in Graph

#1971 Easy

Number of Ways to Arrive at Destination

#1976 Medium

The Time When the Network Becomes Idle

#2039 Medium

Second Minimum Time to Reach Destination

#2045 Hard

Parallel Courses III

#2050 Hard

Maximum Path Quality of a Graph

#2065 Hard

Process Restricted Friend Requests

#2076 Hard

Find All People With Secret

#2092 Hard

Valid Arrangement of Pairs

#2097 Hard

Detonate the Maximum Bombs

#2101 Medium

Find All Possible Recipes from Given Supplies

#2115 Medium

Maximum Employees to Be Invited to a Meeting

#2127 Hard

All Ancestors of a Node in a Directed Acyclic Graph

#2192 Medium

Minimum Weighted Subgraph With the Required Paths

#2203 Hard

Maximum Score of a Node Sequence

#2242 Hard

Longest Path With Different Adjacent Characters

#2246 Hard

Count Unreachable Pairs of Nodes in an Undirected Graph

#2316 Medium

Number of Increasing Paths in a Grid

#2328 Hard

Find Closest Node to Given Two Nodes

#2359 Medium

Longest Cycle in a Graph

#2360 Hard

Reachable Nodes With Restrictions

#2368 Medium

Node With Highest Edge Score

#2374 Medium

Build a Matrix With Conditions

#2392 Hard

Number of Good Paths

#2421 Hard

Most Profitable Path in a Tree

#2467 Medium

Minimum Fuel Cost to Report to the Capital

#2477 Medium

Minimum Score of a Path Between Two Cities

#2492 Medium

Divide Nodes Into the Maximum Number of Groups

#2493 Hard

Minimize the Total Price of the Trips

#2646 Hard

Count the Number of Complete Components

#2685 Medium

Minimum Edge Weight Equilibrium Queries in a Tree

#2846 Hard

Minimum Edge Reversals So Every Node Is Reachable

#2858 Hard

Find Champion II

#2924 Medium

Minimum Cost to Convert String I

#2976 Medium

Count the Number of Houses at a Certain Distance I

#3015 Medium

Minimum Cost Walk in Weighted Graph

#3108 Hard

Find Minimum Time to Reach Last Room I

#3341 Medium

Find Minimum Time to Reach Last Room II

#3342 Medium