Skip to content

Commit

Permalink
Fix day 2 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderscoreTud committed Dec 2, 2024
1 parent d472654 commit 2e4b2a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ fn is_safe(data: &Vec<u32>) -> bool {
let mut previous_direction = None;
for i in 0..(data.len() - 1) {
let diff = data[i].abs_diff(data[i + 1]);
if diff > 3 {
if diff == 0 || diff > 3 {
return false;
}
let direction = data[i].cmp(&data[i + 1]);
Expand Down

0 comments on commit 2e4b2a4

Please sign in to comment.