Leetcode 1547 Solution
This article provides solution to leetcode question 1547 (destination-city)
Access this page by simply typing in "lcs 1547" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/destination-city
Solution
class Solution:
def destCity(self, paths: List[List[str]]) -> str:
in_nodes = set()
out_nodes = set()
for src, dst in paths:
out_nodes.add(src)
in_nodes.add(dst)
return list(in_nodes - out_nodes)[0]