Complete the code to declare the adjacency list for the graph.
List<int>[] graph = new List<int>[[1]];The adjacency list size should be equal to the number of nodes, which is stored in variable n.
Complete the code to add an edge from node u to node v in the adjacency list.
graph[u].[1](v);In C#, the method to add an element to a List is Add with capital A.
Fix the error in the DFS method to mark the current node as visited.
visited[node] = [1];When visiting a node, mark it as true in the visited array.
Fill both blanks to check if a neighbor node is in the recursion stack.
if (recStack[[1]]) { return [2]; }
We check if the neighbor is in the recursion stack and return true if a cycle is detected.
Fill all three blanks to remove the current node from recursion stack and return no cycle found.
recStack[[1]] = [2]; return [3];
After exploring all neighbors, remove the node from recursion stack and return false indicating no cycle found in this path.
