Skip to content

Instantly share code, notes, and snippets.

@Irene-123
Created July 20, 2020 15:19
Show Gist options
  • Save Irene-123/2d6cdf7868ea98da30519f2315d32bba to your computer and use it in GitHub Desktop.
Save Irene-123/2d6cdf7868ea98da30519f2315d32bba to your computer and use it in GitHub Desktop.
Destination City-LeetCode Python solution
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