Topological Sort
Topological Sort
Twenty questions on topological sorting, for ordering tasks with dependencies in a directed acyclic graph.
Course Schedule
mediumThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1.
Course Schedule II
mediumThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1.
Course Schedule IV
mediumThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1.
Find All Possible Recipes from Given Supplies
mediumYou have information about n different recipes.
Find Eventual Safe States
mediumThere is a directed graph of n nodes with each node labeled from 0 to n - 1.
Loud and Rich
mediumThere is a group of n people labeled from 0 to n - 1 where each person has a different amount of money and a different level of quietness.
Minimum Height Trees
mediumA tree is an undirected graph in which any two vertices are connected by exactly one path.
Number of Restricted Paths From First to Last Node
mediumThere is an undirected weighted connected graph.
Number of Ways to Arrive at Destination
mediumYou are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections.
Build a Matrix With Conditions
hardYou are given a positive integer k.
Cat and Mouse
hardA game on an undirected graph is played by two players, Mouse and Cat, who alternate turns.
Cat and Mouse II
hardA game is played by a cat and a mouse named Cat and Mouse.
Collect Coins in a Tree
hardThere exists an undirected and unrooted tree with n nodes indexed from 0 to n - 1.
Count Ways to Build Rooms in an Ant Colony
hardYou are an ant tasked with adding n new rooms numbered 0 to n-1 to your colony.
Frequencies of Shortest Supersequences
hardYou are given an array of strings words.
Largest Color Value in a Directed Graph
hardThere is a directed graph of n colored nodes and m edges.
Longest Cycle in a Graph
hardYou are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge.
Longest Increasing Path in a Matrix
hardGiven an m x n integers matrix, return the length of the longest increasing path in matrix.
Longest Path With Different Adjacent Characters
hardYou are given a tree (i.e.
Maximum Employees to Be Invited to a Meeting
hardA company is organizing a meeting and has a list of n employees, waiting to be invited.