class Solution {
public String destCity(List<List<String>> paths) {
Set<String> hashSet = new HashSet<>();
for (List<String> city :paths){
hashSet.add(city.get(0));
}
for (List<String> city :paths){
if(!hashSet.contains(city.get(1))){
return city.get(1);
}
}
return "";
}
}
set记录第一个城市
第二个城市中没在set中出现的就是返回值