Created
July 20, 2020 15:19
-
-
Save Irene-123/2d6cdf7868ea98da30519f2315d32bba to your computer and use it in GitHub Desktop.
Destination City-LeetCode Python solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def destCity(self, paths: List[List[str]]) -> str: | |
seen=set(p[0] for p in paths) | |
for city in paths: | |
if city[1] not in seen: | |
return city[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment