MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / findItinerary

Function findItinerary

javascript/0332-reconstruct-itinerary.js:6–12  ·  view source on GitHub ↗
(tickets)

Source from the content-addressed store, hash-verified

4 * @return {string[]}
5 */
6var findItinerary = (tickets) => {
7 tickets.sort();
8
9 const graph = buildGraph(tickets);
10
11 return dfs(tickets, graph);
12};
13
14const dfs = (tickets, graph, city = 'JFK', path = ['JFK']) => {
15 const isBaseCase = path.length === tickets.length + 1;

Callers

nothing calls this directly

Calls 2

buildGraphFunction · 0.70
dfsFunction · 0.70

Tested by

no test coverage detected