Created
December 3, 2022 14:43
-
-
Save msgodf/59f8af83af65e32fb101776c1384e4df to your computer and use it in GitHub Desktop.
Day 1, Puzzle 1 of AOC 2022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
most_calories = reverse([for elf_calories in sort([for elf_calories in split(" ", replace(file("input1.txt"), "\n", " ")) : format("%08d", sum([for food_calories in split(" ", elf_calories) : food_calories == "" ? 0 : parseint(food_calories, 10)]))]) : tonumber(elf_calories)])[0] | |
} | |
output "answer" { | |
value = local.most_calories | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment