initial commit

This commit is contained in:
Daniel Yrovas 2022-11-10 16:58:11 +11:00
commit 658f3bfca5
Signed by: danielyrovas
GPG key ID: C181BAC70BDE7C00
31 changed files with 7570 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#![allow(dead_code, unused_imports)]
use anyhow::Result;
use itertools::Itertools;
use std::{io::{stdin, Read}, str::FromStr};
fn descending_window(size: usize) -> Result<usize> {
Ok(aoc::read_one_per_line::<u32>("./data/1.depths")?
.windows(size)
.filter(|win| win[0] < win[size - 1])
.collect_vec()
.len())
}
fn main() -> Result<()> {
println!("Part 1: {}", descending_window(2)?);
println!("Part 2: {}", descending_window(4)?);
Ok(())
}