my solutions to advent of code
aoc advent-of-code

i shouldve used reduce. very little difference but this is better

aylac.top b1650ce3 ed2811a8

verified
Changed files
+7 -3
2025
3
rust
src
+7 -3
2025/3/rust/src/main.rs
···
let (loc, max) = bank[bank_index..bank_len - i]
.iter()
.enumerate()
-
.fold((0_usize, &0_u64), |(maxi, max), (i, n)| {
-
if n > max { (i, n) } else { (maxi, max) }
-
});
+
.reduce(
+
|(maxi, max), (i, n)| {
+
if n > max { (i, n) } else { (maxi, max) }
+
},
+
)
+
// #yup #i'm unwrapping #idontwannausefold
+
.unwrap();
((number * 10) + max, bank_index + loc + 1)
});