Easiest C++ Approach | Fastest Solution [Beats 70%]
\n# Approach\n### Initialization:\n\n- An unordered set st is created to store the starting cities of the paths.\n### Insert Starting Cities into Set:\n\n- The 
\n# Approach\n### Initialization:\n\n- An `unordered set` st is created to store the starting cities of the paths.\n### Insert Starting Cities into Set:\n\n- The first loop iterates through each element in the paths vector.\nFor each path, it inserts the first city (`paths[i][0]`) into the unordered set st.\n### Check for Destination City:\n\n- The second loop again iterates through each element in the paths vector.\n- For each path, it checks if the second city (`paths[i][1]`) is not in the set `st`.\n### Return Destination City:\n\n- If a destination city is found that is not in the set, it is returned immediately.\n- If no such city is found, an `empty string` is returned.\n\n# Complexity\n- Time complexity:\n$$O(n)$$ \n\n- Space complexity:\n$$O(n)$$ \n\n# Code\n```\nclass Solution {\npublic:\n    string destCity(vector<vector<string>>& paths) {\n        // Step 1: Create an unordered set to store the starting cities\n        unordered_set<string> st;\n\n        // Step 2: Iterate through each element in \'paths\' and insert the starting cities into the set\n        for(int i = 0; i < paths.size(); i++) {\n            st.insert(paths[i][0]);\n        }\n\n        // Step 3: Iterate through each element in \'paths\' and check for the destination city\n        for(int i = 0; i < paths.size(); i++) {\n            // Step 4: Check if the destination city is not in the set\n            if(st.find(paths[i][1]) == st.end())\n                // Step 5: Return the destination city if it\'s not in the set\n                return paths[i][1];\n        }\n\n        // Step 6: If no destination city is found, return an empty string\n        return "";\n    }\n};\n\n```
['Hash Table', 'String', 'C++']