this repo has no description

Solve D11P01

modamo e984b1cc 11031bf5

Changed files
+27
day11
+27
day11/part1.ts
··· 1 + import { readFileSync, writeFileSync } from "fs"; 2 + 3 + const rawDeviceMap = readFileSync("./input.txt", "utf8") 4 + .split(/\n/) 5 + .map((line) => line.split(":")) 6 + .map(array => { 7 + return [array[0], [...array[1].trim().split(/\s/)]] 8 + }) 9 + const deviceMap = new Map<string, string[]>([...rawDeviceMap]); 10 + 11 + let numberOfPaths = 0; 12 + 13 + const dfs = (device: string) => { 14 + if (device === "out") { 15 + numberOfPaths++; 16 + 17 + return; 18 + } 19 + 20 + for (const d of deviceMap.get(device)) { 21 + dfs(d); 22 + } 23 + }; 24 + 25 + dfs("you"); 26 + 27 + console.log(numberOfPaths);