C# Solution for Destination City Problem
Intuition\n Describe your first thoughts on how to solve this problem. \n\u2022\tThe program aims to identify the destination city within the provided list of p
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\u2022\tThe program aims to identify the destination city within the provided list of paths.\n\u2022\tIt uses a HashSet to store all unique cities and a Dictionary to map the paths from each city to its destination.\n\u2022\tBy identifying the city without an outgoing path, it determines the destination city.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\u2022\tThe solution starts by creating a HashSet \u2018cities\u2019 to store all unique cities found in the paths.\n\u2022\tIt populates a Dictionary \u2018map\u2019 with mappings from each city to its destination while iterating through the paths.\n\u2022\tThen, it searches for a city in the \u2018cities\u2019 set that is not present as a key in the \u2018map\u2019. Such a city represents the destination city without any outgoing path.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\u2022\tIterating through the paths to populate the \u2018map\u2019 and \u2018cities\u2019 sets takes O(n), where \u2018n\u2019 is the number of paths.\n\u2022\tSearching for the destination city by iterating through the \u2018cities\u2019 set takes O(n) as well, where \u2018n\u2019 is the number of unique cities.\n\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nThe space complexity is O(n) due to the usage of the \u2018map\u2019 and \u2018cities\u2019 sets, where \u2018n\u2019 is the number of paths and unique cities.\n\n# Code\n```\npublic class Solution {\n    public string DestCity(IList<IList<string>> paths) {\n        HashSet<string> cities = new HashSet<string>();\n        Dictionary<string, string> map = new Dictionary<string, string>();\n        \n        foreach (var path in paths) {\n            string fromCity = path[0];\n            string toCity = path[1];\n            \n            cities.Add(fromCity);\n            cities.Add(toCity);\n            \n            map[fromCity] = toCity;\n        }\n        \n        foreach (var city in cities) {\n            if (!map.ContainsKey(city)) {\n                return city;\n            }\n        }\n        \n        return "";\n    }\n}\n```
['C#']