C# solution (DFS)
Intuition\nStarting from city 0, traverse the graph by using DFS\nWhen encountering a foward path, we need to reverse it.\n\nComplexity\n- Time: O(n)\n- Space: 
**Intuition**\nStarting from city ```0```, traverse the graph by using DFS\nWhen encountering a foward path, we need to reverse it.\n\n**Complexity**\n- Time: O(n)\n- Space: O(n)\n\n**Implementation**\n```\npublic class Solution {\n    public int MinReorder(int n, int[][] connections) {\n        \n        List<int>[] graph = new List<int>[n];\n        for(int i = 0; i < n; i++)\n        {\n            graph[i] = new List<int>();\n        }\n\n        HashSet<(int,int)> directedEdges = new HashSet<(int,int)>();\n        \n        for(int i = 0; i < connections.Length; i++)\n        {\n            graph[connections[i][0]].Add(connections[i][1]);\n            graph[connections[i][1]].Add(connections[i][0]);\n\n            directedEdges.Add((connections[i][0], connections[i][1]));\n        }\n\n        int res = 0;\n        HashSet<int> visited = new HashSet<int>();\n\n        dfs(graph, directedEdges, 0, visited, ref res);\n\n        return res;\n    }\n\n    public void dfs(List<int>[] graph, HashSet<(int,int)> directedEdges, int curr, HashSet<int> visited,  ref int res)\n    {\n        visited.Add(curr);\n\n        foreach(var next in graph[curr])\n        {\n            if(!visited.Contains(next))\n            {\n                if(directedEdges.Contains((curr,next)))\n                    res++; \n                dfs(graph, directedEdges, next, visited, ref res);      \n            }               \n        }\n    } \n}\n```
['Depth-First Search', 'Graph', 'C#']