Skip to content

Commit f4c80ac

Browse files
committed
[2025/9] Movie Theater (Part 1)
1 parent a35e2e8 commit f4c80ac

File tree

5 files changed

+532
-1
lines changed

5 files changed

+532
-1
lines changed

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 ||||||||| | | | |||||||||||||| 16 |
32+
| 2025 ||||||||| | | | |||||||||||||| 17 |
3333

3434
## 🛷 How to run
3535

@@ -214,6 +214,7 @@ e.g. `HandyHaversacks`)*
214214
| | 6 | [Trash Compactor](https://adventofcode.com/2025/day/6) | [[Code](src/main/kotlin/adventofcode/year2025/Day06TrashCompactor.kt)] [[Test](src/test/kotlin/adventofcode/year2025/Day06TrashCompactorSpec.kt)] | `5733696195703` | `10951882745757` |
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` |
217+
| | 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` | |
217218

218219
## 🕯️ Useful commands
219220

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package adventofcode.year2025
2+
3+
import adventofcode.Puzzle
4+
import adventofcode.PuzzleInput
5+
import adventofcode.common.spatial.Point2d
6+
import kotlin.math.absoluteValue
7+
8+
class Day09MovieTheater(
9+
customInput: PuzzleInput? = null,
10+
) : Puzzle(customInput) {
11+
private fun parseInput() =
12+
input.lines().map { line ->
13+
val (x, y) = line.split(",").map(String::toLong)
14+
Point2d(x, y)
15+
}
16+
17+
override fun partOne() =
18+
parseInput()
19+
.let { points -> points.flatMapIndexed { index, a -> points.subList(index + 1, points.size).map { b -> a to b } } }
20+
.maxOf { (a, b) -> ((b.x - a.x).absoluteValue + 1) * ((b.y - a.y).absoluteValue + 1) }
21+
}

0 commit comments

Comments
 (0)