Skip to content

Commit 4790e60

Browse files
committed
[2025/11] Reactor (Part 1)
1 parent e311ec0 commit 4790e60

5 files changed

Lines changed: 659 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
| 2022 |||||||||||||| | | | | | | || | | || 28 |
3030
| 2023 |||||||| | | | | | | | | | | | | | | | | | | 12 |
3131
| 2024 ||||||||||||||| |||||| || | || 40 |
32-
| 2025 |||||||||| | | |||||||||||||| 18 |
32+
| 2025 |||||||||| | | |||||||||||||| 19 |
3333

3434
## 🛷 How to run
3535

@@ -215,6 +215,7 @@ e.g. `HandyHaversacks`)*
215215
| | 7 | [Laboratories](https://adventofcode.com/2025/day/7) | [[Code](src/main/kotlin/adventofcode/year2025/Day07Laboratories.kt)] [[Test](src/test/kotlin/adventofcode/year2025/Day07LaboratoriesSpec.kt)] | `1711` | `36706966158365` |
216216
| | 8 | [Playground](https://adventofcode.com/2025/day/8) | [[Code](src/main/kotlin/adventofcode/year2025/Day08Playground.kt)] [[Test](src/test/kotlin/adventofcode/year2025/Day08PlaygroundSpec.kt)] | `135169` | `302133440` |
217217
| | 9 | [Movie Theater](https://adventofcode.com/2025/day/9) | [[Code](src/main/kotlin/adventofcode/year2025/Day09MovieTheater.kt)] [[Test](src/test/kotlin/adventofcode/year2025/Day09MovieTheaterSpec.kt)] | `4777409595` | `1473551379` |
218+
| | 11 | [Reactor](https://adventofcode.com/2025/day/11) | [[Code](src/main/kotlin/adventofcode/year2025/Day11Reactor.kt)] [[Test](src/test/kotlin/adventofcode/year2025/Day11ReactorSpec.kt)] | `699` | |
218219

219220
## 🕯️ Useful commands
220221

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package adventofcode.year2025
2+
3+
import adventofcode.Puzzle
4+
import adventofcode.PuzzleInput
5+
6+
class Day11Reactor(
7+
customInput: PuzzleInput? = null,
8+
) : Puzzle(customInput) {
9+
private fun parseInput() =
10+
input
11+
.lines()
12+
.map { line -> line.split(": ", limit = 2) }
13+
.associate { (fromDevice, toDevices) -> Pair(fromDevice, toDevices.split(" ").toSet()) }
14+
15+
override fun partOne() = parseInput().countPaths(START)
16+
17+
companion object {
18+
private const val START = "you"
19+
private const val END = "out"
20+
21+
private fun Map<String, Set<String>>.countPaths(device: String): Long =
22+
when (device) {
23+
END -> 1
24+
else -> this.getValue(device).sumOf { next -> countPaths(next) }
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)