Slightly better performance

This commit is contained in:
2024-12-05 22:18:26 +01:00
parent ecfe5e9f20
commit f7af07a631
2 changed files with 4 additions and 3 deletions

View File

@@ -6,6 +6,9 @@ locals {
grid = split("\n", chomp(var.input))
height = length(local.grid)
width = length(local.grid[0])
lr = length(regexall("XMAS", var.input))
rl = length(regexall("SAMX", var.input))
}
module "check_point" {
@@ -20,7 +23,7 @@ module "check_point" {
}
output "part1" {
value = sum(module.check_point[*].xmas)
value = sum(module.check_point[*].xmas) + local.lr + local.rl
}
output "part2" {