Skip to content

Commit

Permalink
Merge pull request #38 from ephemient/rs/day4
Browse files Browse the repository at this point in the history
  • Loading branch information
ephemient authored Dec 4, 2024
2 parents d4f6cef + d992bd9 commit 18a960a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rs/src/day4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub fn part1(data: &str) -> usize {
.iter()
.filter_map(move |(dx, dy)| {
try_from_fn(|i| {
y.checked_add_signed(i as isize * dy)
.and_then(|y| lines.get(y))
lines
.get(y + i * dy)
.zip(x.checked_add_signed(i as isize * dx))
.and_then(|(line, x)| line.as_bytes().get(x).copied())
})
Expand Down

0 comments on commit 18a960a

Please sign in to comment.