C++ (multiple approaches. Thanks to DISCUSS section)
\n//Approach-1 (This is what came to my mind quickly)\nclass Solution {\npublic:\n    string destCity(vector<vector<string>>& paths) {\n        unordered_map<st
```\n//Approach-1 (This is what came to my mind quickly)\nclass Solution {\npublic:\n    string destCity(vector<vector<string>>& paths) {\n        unordered_map<string, string> mp;\n        unordered_set<string> st;\n        \n        for(auto &path : paths) {\n            string source = path[0];\n            string dest   = path[1];\n                        \n            mp[source] = dest;\n            \n            st.insert(dest);\n        }\n        \n        for(auto &path : st) {\n            if(!mp.count(path)) return path;\n        }\n        \n        return "";\n    }\n};\n```\n\n```\n//Approach-2 (Then I thought of giving it a try Using DFS)\nclass Solution {\npublic:\n    string result = "";\n    void dfs(string start, unordered_map<string, string>& mp) {\n        if(!mp.count(start)) {\n            result = start;\n            return;\n        }\n        \n        dfs(mp[start], mp);\n    }\n    string destCity(vector<vector<string>>& paths) {\n        unordered_map<string, string> mp;\n        for(auto &path : paths)\n            mp[path[0]] = path[1];\n        \n        string start = paths[0][0];\n        dfs(start, mp);\n        \n        return result;\n    }\n};\n```\n\n```\n//Approach-3 (Iterative DFS)\nclass Solution {\npublic:\n    string destCity(vector<vector<string>>& paths) {\n        unordered_map<string, string> mp;\n        for(auto &path : paths)\n            mp[path[0]] = path[1];\n        \n        string start = paths[0][0];\n        while(mp.find(start) != end(mp))\n            start = mp[start];\n        \n        return start;\n    }\n};\n```\n\n```\n//Approach-4 (My favourite using set)\nclass Solution {\npublic:\n    string destCity(vector<vector<string>>& paths) {\n        unordered_set<string> st;\n        \n        for(auto &path : paths) st.insert(path[1]);\n        for(auto &path : paths) st.erase(path[0]);\n        \n        return *st.begin();\n    }\n};\n```
[]