Stefan | ᕕ(◠ڼ◠)ᕗ says to 電訊台string destCity(vector<vector<string>>& paths) { unordered_map<string, string> adj; for (auto &x : paths) adj[x[0]] = x[1]; auto &x = adj.begin()->second; while (adj.find(x) != adj.end()) x = adj[x]; return x; } endat Tue, Jan 5, 2021 8:06 PM