Files

25 lines
539 B
Markdown
Raw Permalink Normal View History

2024-12-02 23:04:39 -08:00
Advent of code 2024
Day 1
Usage:
rustc d1p1.rs
cat input.txt | ./d1p1
Part 1:
Parse each line into a pair of ints; store them in a pair of heaps.
Convert heaps into sorted lists. Iterate through them together
and find the absolute difference between each pair of numbers.
Part 2:
Parse each line into a pair of ints; store the first in an array,
place the second into a map that accumulate the number of times
a value is seen.
Iterate through the array, adding the number times the number of
times it was seen in the map.