其他分享
首页 > 其他分享> > leetcode-187周赛-5400-旅行终点站

leetcode-187周赛-5400-旅行终点站

作者:互联网

 

提交:O(N)

class Solution:
    def destCity(self, paths: List[List[str]]) -> str:
        dic = {}
        for i,v in paths:
            dic[i] = v
        tmp = paths[0][1]
        while tmp in dic:
            tmp = dic[tmp]
        return tmp

 

标签:tmp,周赛,paths,5400,List,dic,187,str
来源: https://www.cnblogs.com/oldby/p/12823342.html