New update is available. Click here to update.
sidenav-btnClose
Topic list
Topological Sorting
MEDIUM
30 mins
5 upvotes
Graph
Topics (Covered in this problem)
Problem solved
Skill meter
Graph
-
Other topics
Problem solved
Skill meter
Strings
-
Matrices (2D Arrays)
-
Sorting
-
Binary Search
-
Linked List
-
Stacks & Queues
-
Trees
-
Dynamic Programming
-
Greedy
-
Tries
-
Arrays
-
Binary Search Trees
-
Heap
-
Bit Manipulation
-

Topological Sorting

Contributed by
Anup Kumar Singh
Medium
Avg time to solve 30 mins
Success Rate 60 %
Share
5 upvotes

Problem Statement

Given a DAG(direct acyclic graph), print Topological Sorting of a given graph

Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1:
1
5 4
0 2
1 2
3 1
0 4
Sample Output 1:
Correct
Sample Output 1 Explanation:
One correct sort order is : 3 1 0 4 2.
Reset Code
Full screen
copy-code
Console