Module advent_of_code_2022::day_3
source · Expand description
This is my solution for Advent of Code - Day 3 - Rucksack Reorganization
Today’s task is to find the intersection of various character strings, then use a scoring/priority system to get an aggregate of the resulting singleton sets.
Functions
- Get the character(S) in the second string that are also in the first string
- Map a character to a priority based on its position in the alphabet and whether it is uppercase.
- Convert the input to a list of the lines as individual strings
- The entry point for running the solutions with the ‘real’ puzzle input.
- Chunk the input lines into groups of three, find the singleton intersection of each group and sum their priorities.
- Map the inputs to two compartments, find the singleton intersecting character, map to a priority and sum.