C++ and C# with 3 different approaches.
\n\nC++ []\nclass Solution {\npublic:\n  string destCity(vector<vector<string>>& paths) {\n        unordered_map<string, string> m;\n        for(auto& e: paths)
![photo_2023-04-15_22-23-13.jpg](https://assets.leetcode.com/users/images/bf3d52c7-4aa6-4757-a82f-b59016be1065_1681579584.3691025.jpeg)\n\n```C++ []\nclass Solution {\npublic:\n  string destCity(vector<vector<string>>& paths) {\n        unordered_map<string, string> m;\n        for(auto& e: paths)     m[e[0]] = e[1];\n        string cur(paths[0][0]);\n        while(m.count(cur))\n            cur = m[cur];\n        return cur;\n    }\n};\n```\n```C++ []\nclass Solution {\npublic:\n    string destCity(vector<vector<string>>& paths) {\n        set<string> myset;int i;\n        for( i=0;i<paths.size();i++)\n        myset.insert(paths[i][1]);\n        for( i=0;i<paths.size();i++)\n        {\n            if(myset.find(paths[i][0])!=myset.end())\n            myset.erase(paths[i][0]);\n        }\n     return *myset.begin();\n    }\n};\n```\n```C++ []\nclass Solution {\npublic:\n  string destCity(vector<vector<string>>& paths) {\n        unordered_map<string, string> m;\n        for(auto& e: paths)     m[e[0]] = e[1];\n        string cur(paths[0][0]);\n        while(m.find(cur)!=m.end())\n            cur = m[cur];\n        return cur;\n    }\n};\n```\n```C# []\npublic class Solution {\n    public string DestCity(IList<IList<string>> paths) {\n        var m = new Dictionary<string, string>();\n        foreach (var e in paths)\n            m[e[0]] = e[1];\n        string cur = paths[0][0];\n        while (m.ContainsKey(cur))\n            cur = m[cur];\n        return cur;\n    }\n}\n```\n```C# []\npublic class Solution {\n    public string DestCity(IList<IList<string>> paths) {\n        Dictionary<string, string> map = new Dictionary<string, string>();\n        foreach (var path in paths) {\n            map[path[0]] = path[1];\n        }\n        string cur = paths[0][0];\n        while (map.ContainsKey(cur)) {\n            cur = map[cur];\n        }\n        return cur;\n    }\n}\n```\n```C# []\npublic class Solution {\n    public string DestCity(IList<IList<string>> paths) {\n        HashSet<string> myset=new HashSet<string>();\n        for(int i=0;i<paths.Count;i++)\n        myset.Add(paths[i][1]);\n        for(int i=0;i<paths.Count;i++){\n            if(myset.Contains(paths[i][0]))\n            myset.Remove(paths[i][0]);\n        }\n        return myset.FirstOrDefault();\n    }\n}\n```\n\n![Vote.png](https://assets.leetcode.com/users/images/fbc65264-3065-4f42-930e-8b71e7706d95_1681579738.4058306.png)\n\n\n
['Hash Table', 'String', 'C++', 'C#']