To run the solutions run the following command:
cargo run -- src/input.txt
- Extract the two columns into vectors.
- Sort the vectors.
- Iterate through the vectors determining the difference between the two values.
- Add the difference to a count variable
res
.
- Extract the two columns into vectors.
- Iterate through the first vector - for each value count the number of times the value appears in the vector.
- Multiply the count by the current value.
- Add the value to a count variable
res
.