day_1

Day 1

For part 1, we can use the builtin list.zip function to pair up the two lists and then get the absolute difference between the two numbers in each pair. The result can then be summed.

For part 2, we take each element of the left list and sort the right list by the distance to calculate a per-element similarity (which can then be summed again).

Functions

pub fn get_data() -> #(List(Int), List(Int))
pub fn main() -> Nil
pub fn parse_entry(entry: String) -> Int
pub fn parse_row(line: String) -> List(Int)
pub fn part_1() -> Nil
pub fn part_2() -> Nil
Search Document