facil solution
Approach\n Describe your approach to solving the problem. \n1. we map path[0] as a key => path[1] as a value into hashMap\n2. then we can easily seen the only c
# Approach\n<!-- Describe your approach to solving the problem. -->\n1. we map path[0] as a key => path[1] as a value into hashMap\n2. then we can easily seen the only city has no path to other city\n\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nif a city has connection to the other cities, it has to be show in path[0] and path[1] in some point\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n\n```typescript []\nfunction destCity(paths: string[][]): string {\n  let hashMap = new Map<string, string>();\n\n  for (let path of paths) {\n    hashMap.set(path[0], path[1]);\n  }\n\n  for (let value of hashMap.values()) {\n    if (!hashMap.has(value)) {\n      return value;\n    }\n  }\n};\n```\n```golang []\nfunc destCity(paths [][]string) string {\n    hashMap := make(map[string]string)\n\n\tfor _, path := range paths {\n\t\thashMap[path[0]] = path[1]\n\t}\n\n\tfor _, city := range hashMap {\n\t\tif _, exists := hashMap[city]; !exists {\n\t\t\treturn city\n\t\t}\n\t}\n\n\treturn ""\n}\n```\n```ruby []\ndef dest_city(paths)\n  hash_map = {}\n\n  paths.each do |path|\n    hash_map[path[0]] = path[1]\n  end\n\n  hash_map.each_value do |city|\n    return city unless hash_map.key?(city)\n  end\n\n  nil\nend\n```\n```rust []\nuse std::collections::HashMap;\n\nimpl Solution {\n    pub fn dest_city(paths: Vec<Vec<String>>) -> String {\n        let mut hash_map = HashMap::new();\n\n        for path in paths.iter() {\n            hash_map.insert(path[0].clone(), path[1].clone());\n        }\n\n        for city in hash_map.values() {\n            if !hash_map.contains_key(city) {\n                return city.clone();\n            }\n        }\n\n        String::new()\n    }\n}\n```\n\n
['Hash Table', 'Go', 'TypeScript', 'Rust', 'Ruby']