Skip to content

Commit

Permalink
[2024/3] Mull It Over (Part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfolta committed Dec 3, 2024
1 parent 6998398 commit e6391d2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
| 2021 | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | | β˜… | β˜… | | | | | | | | | | | | 26 |
| 2022 | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | β˜… | | | | | | | | β˜† | | | | β˜† | 28 |
| 2023 | β˜… | β˜… | β˜… | β˜… | β˜† | β˜… | β˜† | | | | | | | | | | | | | | | | | | | 12 |
| 2024 | β˜… | β˜… | | | | | | | | | | | | | | | | | | | | | | | | 4 |
| 2024 | β˜… | β˜… | β˜† | | | | | | | | | | | | | | | | | | | | | | | 5 |

## πŸ›· How to run

Expand Down Expand Up @@ -164,6 +164,7 @@ e.g. `HandyHaversacks`)*
| | 7 | [Camel Cards](https://adventofcode.com/2023/day/7) | [[Code](src/main/kotlin/adventofcode/year2023/Day07CamelCards.kt)] [[Test](src/test/kotlin/adventofcode/year2023/Day07CamelCardsSpec.kt)] | `250474325` | |
| [**2024**](https://adventofcode.com/2024) | 1 | [Historian Hysteria](https://adventofcode.com/2024/day/1) | [[Code](src/main/kotlin/adventofcode/year2024/Day01HistorianHysteria.kt)] [[Test](src/test/kotlin/adventofcode/year2024/Day01HistorianHysteriaSpec.kt)] | `1970720` | `17191599` |
| | 2 | [Red-Nosed Reports](https://adventofcode.com/2024/day/2) | [[Code](src/main/kotlin/adventofcode/year2024/Day02RedNosedReports.kt)] [[Test](src/test/kotlin/adventofcode/year2024/Day02RedNosedReportsSpec.kt)] | `572` | `612` |
| | 3 | [Mull It Over](https://adventofcode.com/2024/day/3) | [[Code](src/main/kotlin/adventofcode/year2024/Day03MullItOver.kt)] [[Test](src/test/kotlin/adventofcode/year2024/Day03MullItOverSpec.kt)] | `174960292` | |

## πŸ•―οΈ Useful commands

Expand Down
16 changes: 16 additions & 0 deletions src/main/kotlin/adventofcode/year2024/Day03MullItOver.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package adventofcode.year2024

import adventofcode.Puzzle
import adventofcode.PuzzleInput

class Day03MullItOver(customInput: PuzzleInput? = null) : Puzzle(customInput) {
override fun partOne() =
mulRegex
.findAll(input)
.map { it.destructured }
.sumOf { (x, y) -> x.toInt() * y.toInt() }

companion object {
private val mulRegex = """mul\((\d{1,3}),(\d{1,3})\)""".toRegex()
}
}
Loading

0 comments on commit e6391d2

Please sign in to comment.