toposort bfs
public static ArrayList<Integer> topoSort(int V, int[][] edges){
int indegree[] = new int[V]; // Step 1: In-degree array
ArrayList<ArrayList<Integer>> adj = new ArrayList<>();
for(int i = 0; i < V; i++) adj.add(new ArrayList<>());
//...
yesamitsingh.hashnode.dev1 min read