Skip to content

Commit dc05400

Browse files
committed
skip copy
1 parent e415ab5 commit dc05400

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

results/2024.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
{
2828
"day": 5,
2929
"part1": "4665",
30-
"part2": ""
30+
"part2": "1688"
3131
}
3232
]

src/aoc2024/day6.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl Solution<Day6> for Aoc2024 {
4242

4343
fn part2((grid, sx, sy): &(Grid<bool>, usize, usize)) -> usize {
4444
let mut res = 0;
45+
let mut ngrid = grid.clone();
4546
for y in 0..grid.height {
4647
for x in 0..grid.width {
4748
if (x, y) == (*sx, *sy) {
@@ -52,12 +53,11 @@ impl Solution<Day6> for Aoc2024 {
5253
continue;
5354
}
5455

55-
let mut ngrid = grid.clone();
5656
ngrid.set(x, y, true);
57-
5857
if compute_path_size(&ngrid, *sx, *sy).is_none() {
5958
res += 1;
6059
}
60+
ngrid.set(x, y, false);
6161
}
6262
}
6363

0 commit comments

Comments
 (0)