MCPcopy Create free account
hub / github.com/ROUTINE-STUDY/Algorithm / destCity

Function destCity

LeetCode/String/1436. Destination City/JaeHong.js:1–8  ·  view source on GitHub ↗
(paths)

Source from the content-addressed store, hash-verified

1var destCity = function (paths) {
2 let dest = paths[0][1];
3 while (true) {
4 const _newDest = paths.find((path) => path[0] === dest);
5 if (!_newDest) return dest;
6 dest = _newDest[1];
7 }
8};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected