Day 4 (Puzzle 2) - Camp Cleanup

Adapted the final overlap check to count anything not 0 instead and it succeeded the second puzzle.
main
Peery 2 years ago
parent 0945923f9f
commit 76ae30f975

@ -73,12 +73,12 @@ fn main() {
let overlaps: Vec<u32> = check_for_overlaps(&pair); let overlaps: Vec<u32> = check_for_overlaps(&pair);
//println!("Overlap is: {:?}", overlaps); //println!("Overlap is: {:?}", overlaps);
if overlaps.len() == pair[0].len() || overlaps.len() == pair[1].len() { if overlaps.len() != 0 {
println!("Found a complete overlap in the following pair: {:?}", pair); println!("Found an overlap in the following pair: {:?}", pair);
complete_overlap_count += 1; complete_overlap_count += 1;
} }
} }
println!(); println!();
println!("Found {} pairs with complete overlaps!", complete_overlap_count); println!("Found {} pairs with overlaps!", complete_overlap_count);
} }
Loading…
Cancel
Save