Skip to content

Instantly share code, notes, and snippets.

View and-reas-se's full-sized avatar

Andreas and-reas-se

  • Göteborg, Sweden
View GitHub Profile
@and-reas-se
and-reas-se / main.rs
Created December 4, 2021 22:27
Advent of Code day 4 in rust
fn main() {
let input_file = std::env::args().nth(1).expect("Input filename missing");
let input = std::fs::read_to_string(input_file).expect("Error reading file");
let numbers = input
.lines()
.next()
.unwrap()
.split(',')
.map(|num| num.parse().expect("invalid number"))