1436. Destination City ¶ Time: Space: Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14class Solution: def destCity(self, paths: list[list[str]]) -> str: count = collections.Counter() for a, b in paths: count[a] += 1 for a, b in paths: if b in count: count[b] -= 1 if count[b] == 0: del count[b] else: return b