Python, beats 87%, clean solution with recursion
IntuitionDespite directioned edge, we should setup graph with biderectional edges, with marking current direction.
Setup recursion, which will consider conectio
# Intuition
Despite directioned edge, we should setup graph with biderectional edges, with marking current direction.
Setup recursion, which will consider conection existance and current direction


# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
O(N)

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def minReorder(self, n: int, connections: List[List[int]]) -> int:
        g = defaultdict(lambda : [])
        
        for a, b in connections:
            g[a].append([b, 1])   # direction out
            g[b].append([a, 0]) 
                    
        def traverse(node, prev_node=None, cnt_changes=0) ->int:                
            for next_node, direction in g[node]:
                if next_node == prev_node:
                    continue                
                cnt_changes += direction + traverse(next_node, node)
                                
            return cnt_changes

        return traverse(0)
        
```
['Python3']