day 3 puzzle 1
This commit is contained in:
16
src/day3/puzzle1.typ
Normal file
16
src/day3/puzzle1.typ
Normal file
@ -0,0 +1,16 @@
|
||||
#import "/src/utils.typ": *
|
||||
|
||||
#let solve(input) = {
|
||||
let matches = input.matches(regex("mul\((\d{1,3}),(\d{1,3})\)"))
|
||||
let total = matches.map(m => {
|
||||
m.captures.map(int)
|
||||
.product()
|
||||
}).sum()
|
||||
return total
|
||||
}
|
||||
|
||||
#show-puzzle(
|
||||
3, 1,
|
||||
solve,
|
||||
example: 161
|
||||
)
|
0
src/day3/puzzle2.typ
Normal file
0
src/day3/puzzle2.typ
Normal file
BIN
src/main.pdf
BIN
src/main.pdf
Binary file not shown.
Reference in New Issue
Block a user