Easy JavaScript Solution using Queue and Insverse Graph. 92% faster then others.
Intuition\n1.  Create Inverse Graph and Graph\n2. Take Queue with 0\n3. Loop through Queue and visit Inserve Geaph AND Graph\n4. IF Visited Through Graph ANSWER
# Intuition\n1.  Create Inverse Graph and Graph\n2. Take Queue with 0\n3. Loop through Queue and visit Inserve Geaph AND Graph\n4. IF Visited Through Graph ANSWER++ AND VISITED\n5. SAME PROCESSS TILL Queue is not empty\n6. NOTE: this approach works her because we do have n-1 roads\n\n\n**PLEASE UPVOTE!!!**\n```\nvar minReorder = function(n, connections) {\n    let ans = 0;\n    let graph = new Array(n).fill().map(_=>new Array());\n    let inverse = new Array(n).fill().map(_=>new Array());\n    let visited = new Array(n).fill(0);\n    for(let i=0;i<connections.length;i++) {\n      let [from,to] = connections[i];\n      graph[from].push(to);\n      inverse[to].push(from);\n    }\n\n    let q =[0];\n   \n    visited[0]=1;\n   while(q.length>0) {\n    let val = q.pop();\n    visited[val]=1;\n    for(let i=0;i<inverse[val].length;i++) {\n      let  node = inverse[val][i];\n      if(visited[node] !== 1) {\n        q.push(node);\n        visited[node]=1\n      }\n    };\n    for(let i=0;i<graph[val].length;i++) {\n      let  node = graph[val][i];\n      if(visited[node] !== 1) {\n       q.push(node);\n       visited[node]=1\n        ans++;\n      }\n    };   \n   }\n\n   return ans\n    \n   \n\n\n};\n```
['JavaScript']