diff --git a/2020/src/bin/day08.rs b/2020/src/bin/day08.rs index 51ab5d8..d3e6815 100644 --- a/2020/src/bin/day08.rs +++ b/2020/src/bin/day08.rs @@ -61,7 +61,7 @@ fn part2(commands: &Vec, seen: &mut Vec, mut index: i32, mut acc: seen[index as usize] = true; match commands[index as usize] { Command::NOP(x) => { - if !changed { + if !changed && index > -x { if let Some(n) = part2(commands, seen, index + x, acc, true) { return Some(n); }