This commit is contained in:
Benjamyn Love 2024-12-02 17:32:08 +11:00
parent 6aa3307d38
commit 0992350e32

View File

@ -42,18 +42,21 @@ impl LocationList {
println!("{}", total); println!("{}", total);
} }
// fn check_dupes(&mut self) { fn solve2(&mut self) {
// for (outer_pos, entry_outer) in self.left.iter().enumerate() { let mut total = 0;
// for (inner_pos, entry_inner) in self.right.iter().enumerate() { for (_, entry_outer) in self.left.iter().enumerate() {
// if entry_inner == entry_outer { let mut inner_total = 0;
// println!( for (_, entry_inner) in self.right.iter().enumerate() {
// "Outer: {}, Inner: {}, O_Pos: {}, I_POS: {}", if entry_inner == entry_outer {
// entry_outer, entry_inner, outer_pos, inner_pos inner_total += 1;
// ) }
// } }
// } if inner_total != 0 {
// } total += entry_outer * inner_total
// } };
}
println!("{}", total);
}
} }
impl fmt::Debug for LocationList { impl fmt::Debug for LocationList {
@ -86,4 +89,5 @@ fn main() {
location_list.parse_data(data); location_list.parse_data(data);
location_list.solve(); location_list.solve();
location_list.solve2();
} }