refactored project structure

This commit is contained in:
2025-12-09 20:11:49 +01:00
parent 87bacd3b4c
commit 7928c2334f
69 changed files with 783 additions and 354 deletions

20
src/day01/part01a.rs Normal file
View File

@@ -0,0 +1,20 @@
pub fn solve(puzzle: String) -> u64 {
let mut solution: u64 = 0;
let mut dial: i32 = 50;
puzzle.split("\n").enumerate().for_each(|(_, line)| {
let direction: i32 = match &line[0..1] {
"L" => -1,
"R" => 1,
_ => 0,
};
dial += direction * line[1..line.len()].parse::<i32>().unwrap();
dial %= 100;
if dial == 0 {
solution += 1;
}
});
solution
}