1
0
Fork 0

day(05): add todo and comment out unused

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-12-07 10:43:08 +01:00
parent 715904ca2b
commit 0f5e11a79f
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -43,14 +43,14 @@ impl AlmanacRange {
Some(self.destination + (key - self.source))
}
fn maps_to(&self) -> (i64, i64) {
(self.destination, self.destination + self.length)
}
// fn maps_to(&self) -> (i64, i64) {
// (self.destination, self.destination + self.length)
// }
fn overlaps(&self, start: i64, length: i64) -> bool {
(start < self.source || self.has(start))
&& (start + length >= self.upper_bound() || self.has(start + length))
}
// fn overlaps(&self, start: i64, length: i64) -> bool {
// (start < self.source || self.has(start))
// && (start + length >= self.upper_bound() || self.has(start + length))
// }
}
struct Mapping {
@ -102,6 +102,8 @@ impl Solution<Output1, Output2> for Day05 {
}
fn part_2(&mut self) -> Output2 {
// TODO: Optimize this part,
// even though it runs in 20s with rayon and release build
let indices = (0..self.seeds.len())
.map(|i| 2 * i)
.take_while(|i| *i < self.seeds.len() - 1)