Skip to content

Commit 9f86ed0

Browse files
authored
Update 1436-destination-city.js
1 parent ac9328b commit 9f86ed0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

1436-destination-city.js

+14
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,17 @@ const destCity = function(paths) {
1414
if(hash[k]) return k
1515
}
1616
};
17+
18+
// another
19+
20+
/**
21+
* @param {string[][]} paths
22+
* @return {string}
23+
*/
24+
const destCity = function(paths) {
25+
const set = new Set()
26+
for(let [s, e] of paths) set.add(e)
27+
for(let [s, e] of paths) set.delete(s)
28+
29+
return set[Symbol.iterator]().next().value
30+
};

0 commit comments

Comments
 (0)