Given the number of courses n and an array of prerequisites , return the ordering of courses one should take to finish all the courses.
prerequisites[i] = [a,b] indicates that course b must be taken before course a
Input:
4
[[1,0],[2,0],[3,1],[3,2]]
Output:
[0,2,1,3]
Details
Technical Specifications: C,C++,Python
Type of issue: Single
Time Limit: 1 day after the issue is assigned
Directory Structure
Create a folder topological-sorting under Algorithms folder. All the files should be placed inside this folder
Note
Please claim the issue first by commenting here before starting to work on it.
Once you are done with the task and have created a Pull Request, please tag @Ashwin901 to request a review.
Description
Given the number of courses
n
and an array ofprerequisites
, return the ordering of courses one should take to finish all the courses.prerequisites[i] = [a,b]
indicates that courseb
must be taken before coursea
Input:
4 [[1,0],[2,0],[3,1],[3,2]]
Output:
[0,2,1,3]
Details
Directory Structure
Create a folder
topological-sorting
underAlgorithms
folder. All the files should be placed inside this folderNote