helper function
| 15 | |
| 16 | // helper function |
| 17 | bool dfs(vector<vector<int>>& adjlist, vector<int>& visited, int i) { |
| 18 | |
| 19 | // base condition |
| 20 | if(visited[i]==1) return false; |
| 21 | visited[i]=1; // mark as being visited |
| 22 | |
| 23 | for(int a:adjlist[i]) { |
| 24 | if(!dfs(adjlist, visited, a)) // dfs(adjlist, visited, a) == false |
| 25 | return false; |
| 26 | } |
| 27 | |
| 28 | visited[i] = 2; // mark as visited |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | |
| 33 | bool canFinish(int numc, vector<vector<int>>& prereq) { |
nothing calls this directly
no outgoing calls
no test coverage detected