day 9 part 2

This commit is contained in:
Andy Teijelo 2023-12-09 11:27:09 -05:00
parent 592d4fe2c2
commit 157915cae5

View file

@ -30,7 +30,7 @@ fn main() -> Result<()> {
} }
let mut prediction = 0; let mut prediction = 0;
for seq in sequences.iter().rev() { for seq in sequences.iter().rev() {
prediction += seq.last().unwrap(); prediction = seq.first().unwrap() - prediction;
} }
println!("{prediction}"); println!("{prediction}");
sum += prediction; sum += prediction;