mirror of
https://github.com/LeMoonStar/AoC24.git
synced 2025-07-07 21:49:59 +02:00
🐛 Day 2: Fixed edge-case in part 2 with errors at end of Report
This commit is contained in:
parent
e1e9051ccb
commit
b2c8337177
1 changed files with 5 additions and 1 deletions
|
@ -21,7 +21,11 @@ impl Report {
|
|||
}
|
||||
|
||||
if !Self::safe_comparison(self.0[i - 1], self.0[i], &mut direction) {
|
||||
if tolerance > 0 && i + 1 < self.0.len() {
|
||||
if tolerance > 0 {
|
||||
if (i + 1 >= self.0.len()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
tolerance -= 1;
|
||||
if !Self::safe_comparison(self.0[i - 1], self.0[i + 1], &mut direction) {
|
||||
skip = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue