Destination City LeetCode solution in Python
1# Runtime: 101 ms (Top 25.06%) | Memory: 13.8 MB (Top 81.64%)2from collections import defaultdict345class Solution:6def destCity(self, paths: List[List[str]]) -> str:7deg = defaultdict(int)8for v, w in paths:9deg[v] += 110deg[w]11for v in deg:12if not deg[v]:13return v