graph
생성paths
를 순회하며 graph
정의graph
를 순회하며 도착지 중 출발지가 아닌 요소 탐색function destCity(paths: string[][]): string {
const graph = new Map()
for(const [from, to] of paths) {
graph.set(from, to)
}
for(const [from, to] of graph) {
if(graph.has(to)) continue
return to
}
return ''
};