Topological Sort Problems
Master topological sort problems with AI-powered solutions. Get instant coding assistance during your technical interviews for all 23 problems in this category.
Total Problems: 23
Medium: 8
Hard: 15
Showing 23 of 23 problems
Problems
Scroll within this area to browse all problems
#
Title
Difficulty
Topological Sort LeetCode Problems List
- 207. Course Schedule - Medium - Topological SortThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 210. Course Schedule II - Medium - Topological SortThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 329. Longest Increasing Path in a Matrix - Hard - Topological SortGiven an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: le... Topics: Array, Dynamic Programming, Depth-First Search, Breadth-First Search, Graph, Topological Sort, Memoization, Matrix
- 1558. Course Schedule IV - Medium - Topological SortThere are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 2364. Longest Path With Different Adjacent Characters - Hard - Topological SortYou are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of n nodes numbered from 0 to n - 1. The tree... Topics: Array, String, Tree, Depth-First Search, Graph, Topological Sort
- 2439. Longest Cycle in a Graph - Hard - Topological SortYou are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge. The graph is represented with a giv... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 310. Minimum Height Trees - Medium - Topological SortA tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles i... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 949. Cat and Mouse - Hard - Topological SortA game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follows: graph[a] is a list of all n... Topics: Math, Dynamic Programming, Graph, Topological Sort, Memoization, Game Theory
- 2409. Number of Increasing Paths in a Grid - Hard - Topological SortYou are given an m x n integer matrix grid, where you can move from a cell to any adjacent cell in all 4 directions. Return the number of strictly inc... Topics: Array, Dynamic Programming, Depth-First Search, Breadth-First Search, Graph, Topological Sort, Memoization, Matrix
- 2220. Find All Possible Recipes from Given Supplies - Medium - Topological SortYou have information about n different recipes. You are given a string array recipes and a 2D string array ingredients. The ith recipe has the name re... Topics: Array, Hash Table, String, Graph, Topological Sort
- 3919. Network Recovery Pathways - Hard - Topological SortYou are given a directed acyclic graph of n nodes numbered from 0 to n − 1. This is represented by a 2D array edges of length m, where edges[i] = [ui,... Topics: Array, Binary Search, Dynamic Programming, Graph, Topological Sort, Heap (Priority Queue), Shortest Path
- 2472. Build a Matrix With Conditions - Hard - Topological SortYou are given a positive integer k. You are also given: a 2D integer array rowConditions of size n where rowConditions[i] = [abovei, belowi], and a 2D... Topics: Array, Graph, Topological Sort, Matrix
- 2090. Number of Ways to Arrive at Destination - Medium - Topological SortYou are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections. The inputs are gener... Topics: Dynamic Programming, Graph, Topological Sort, Shortest Path
- 1257. Rank Transform of a Matrix - Hard - Topological SortGiven an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank is an integer that represents how l... Topics: Array, Union Find, Graph, Topological Sort, Sorting, Matrix
- 820. Find Eventual Safe States - Medium - Topological SortThere is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D integer array graph where grap... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 1986. Largest Color Value in a Directed Graph - Hard - Topological SortThere is a directed graph of n colored nodes and m edges. The nodes are numbered from 0 to n - 1. You are given a string colors where colors[i] is a l... Topics: Hash Table, Dynamic Programming, Graph, Topological Sort, Memoization, Counting
- 1727. Cat and Mouse II - Hard - Topological SortA game is played by a cat and a mouse named Cat and Mouse. The environment is represented by a grid of size rows x cols, where each element is a wall,... Topics: Array, Math, Dynamic Programming, Graph, Topological Sort, Memoization, Matrix, Game Theory
- 2717. Collect Coins in a Tree - Hard - Topological SortThere exists an undirected and unrooted tree with n nodes indexed from 0 to n - 1. You are given an integer n and a 2D integer array edges of length n... Topics: Array, Tree, Graph, Topological Sort
- 1431. All Ancestors of a Node in a Directed Acyclic Graph - Medium - Topological SortYou are given a positive integer n representing the number of nodes of a Directed Acyclic Graph (DAG). The nodes are numbered from 0 to n - 1 (inclusi... Topics: Depth-First Search, Breadth-First Search, Graph, Topological Sort
- 2176. Parallel Courses III - Hard - Topological SortYou are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given a 2D integer array relations where relati... Topics: Array, Dynamic Programming, Graph, Topological Sort
- 2246. Maximum Employees to Be Invited to a Meeting - Hard - Topological SortA company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seat... Topics: Depth-First Search, Graph, Topological Sort
- 3713. Frequencies of Shortest Supersequences - Hard - Topological SortYou are given an array of strings words. Find all shortest common supersequences (SCS) of words that are not permutations of each other. A shortest co... Topics: Array, String, Bit Manipulation, Graph, Topological Sort, Enumeration
- 3826. Maximum Profit from Valid Topological Order in DAG - Hard - Topological SortYou are given a Directed Acyclic Graph (DAG) with n nodes labeled from 0 to n - 1, represented by a 2D array edges, where edges[i] = [ui, vi] indicate... Topics: Array, Dynamic Programming, Bit Manipulation, Graph, Topological Sort, Bitmask
Related LeetCode Topics
- Array LeetCode Problems
- Backtracking LeetCode Problems
- Biconnected Component LeetCode Problems
- Binary Indexed Tree LeetCode Problems
- Binary Search LeetCode Problems
- Binary Search Tree LeetCode Problems
- Binary Tree LeetCode Problems
- Bit Manipulation LeetCode Problems
- Bitmask LeetCode Problems
- Brainteaser LeetCode Problems
- Breadth-First Search LeetCode Problems
- Bucket Sort LeetCode Problems
- Combinatorics LeetCode Problems
- Concurrency LeetCode Problems
- Counting LeetCode Problems
- Counting Sort LeetCode Problems
- Data Stream LeetCode Problems
- Database LeetCode Problems
- Depth-First Search LeetCode Problems
- Design LeetCode Problems