Skip to content

Commit ac9328b

Browse files
authored
Create 1436-destination-city.js
1 parent e9ef8ad commit ac9328b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

1436-destination-city.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @param {string[][]} paths
3+
* @return {string}
4+
*/
5+
const destCity = function(paths) {
6+
const hash = {}
7+
for(let [s, e] of paths) {
8+
if(hash[e] == null) hash[e] = true
9+
hash[s] = false
10+
if(hash[s] === true) hash[s] = false
11+
}
12+
13+
for(let k in hash) {
14+
if(hash[k]) return k
15+
}
16+
};

0 commit comments

Comments
 (0)