Skip to content

Commit 80ee720

Browse files
committed
Day 20 Part 2... not working, too high
1 parent c0b557a commit 80ee720

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/d20.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function programReadLine(rl) {
1919
function run(path) {
2020
let current = newChild();
2121
let maxDoors = -Infinity;
22+
let over1000doors = 0;
2223

2324
path.forEach((char, idx) => {
2425
switch (char) {
@@ -46,13 +47,14 @@ function run(path) {
4647
// one more step on the current path
4748
current.doors++;
4849
maxDoors = Math.max(maxDoors, current.doors);
50+
if (current.doors >= 1000) over1000doors++;
4951
break;
5052
}
5153
});
5254

5355
return {
5456
part1: maxDoors,
55-
part2: undefined
57+
part2: over1000doors
5658
};
5759
}
5860

0 commit comments

Comments
 (0)