pub fn y23d03p1(input: &str) -> u32
Expand description
The solution for part one of the day three challenge.
Given the problem input as a string we start by building a grid
representation of each character into a std::collections::HashMap
then
we loop through our grid line by line and character by character. We keep
track if we’ve found a number and then when we either stop seeing numbers
or we get to the end of the line we check to see if what we’ve found is
adjacent to any of the symbols present in the grid and if it is then we add
it to the final sum.
§Example
// probably read this from the input file...
let input = "123.\n.*..\n....\n.456";
assert_eq!(y23d03p1(input), 123);