[ Without Graph ] Simple Solution using Set, faster than 100.00% of C++ online submissions
\nclass Solution {\npublic:\n    int minReorder(int n, vector<vector<int>>& connections) {\n        set <int > vv;\n        int c=0;\n        int l=connections.
```\nclass Solution {\npublic:\n    int minReorder(int n, vector<vector<int>>& connections) {\n        set <int > vv;\n        int c=0;\n        int l=connections.size();\n        for(int i=0;i<l;i++)\n        {\n            if(connections[i][1]==0 || connections[i][0]==0)\n            {\n                if(connections[i][0]==0)\n                {\n                    c++;\n                }\n                vv.insert(connections[i][1]);\n                vv.insert(connections[i][0]);\n                break;\n            }\n        }\n        for(int i=0;i<l;i++)\n        {\n            if(vv.find(connections[i][1]) == vv.end())\n            {\n                c++;\n                vv.insert(connections[i][1]);\n            }\n            else{\n                vv.insert(connections[i][0]);\n            }\n        }\n        return c;\n    }\n};\n```
['C', 'Ordered Set']