This commit is contained in:
JonOfUs 2023-12-08 11:53:56 +01:00
parent 461169bfab
commit 9790369331

View file

@ -19,19 +19,19 @@ pub fn solve() {
}) })
.collect(); .collect();
// let mut curr = String::from("AAA"); let mut curr = String::from("AAA");
// let mut i = 0; let mut i = 0;
// while curr != String::from("ZZZ") { while curr != String::from("ZZZ") {
// dbg!(curr.as_str()); dbg!(curr.as_str());
// curr = match instr[i % instr.len()] { curr = match instr[i % instr.len()] {
// 'L' => map.get(curr.as_str()).unwrap().0.clone(), 'L' => map.get(curr.as_str()).unwrap().0.clone(),
// 'R' => map.get(curr.as_str()).unwrap().1.clone(), 'R' => map.get(curr.as_str()).unwrap().1.clone(),
// _ => panic!() _ => panic!()
// }; };
// i+=1; i+=1;
// }
// println!("Result 1: {}", i);
println!("Result 1: {}", i);
let mut curr: Vec<String> = map.keys() let mut curr: Vec<String> = map.keys()
@ -55,13 +55,12 @@ pub fn solve() {
}); });
i+=1; i+=1;
} }
dbg!(steps.clone());
let result = steps.iter() let result = steps.iter()
.fold(1, |x,y| { .fold(1, |x,y| {
num::integer::lcm(x,*y) num::integer::lcm(x,*y)
}); });
println!("Result 1: {}", result); println!("Result 2: {}", result);
} }