Skip to content

Commit f2cb83c

Browse files
committed
Fix handling of duplicate digits in 2024 day 21
and remove unused variable
1 parent 7503d94 commit f2cb83c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

crates/year2024/src/day21.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ impl Day21 {
9494
let mut queue = BinaryHeap::new();
9595
for start in NumericKeypad::ALL {
9696
queue.push(Reverse((0, start, DirectionalKeypad::Activate)));
97-
result[start as usize][start as usize] = 0;
98-
let mut best = [u32::MAX; NumericKeypad::LEN];
99-
best[start as usize] = 1;
97+
result[start as usize][start as usize] = 1;
10098
while let Some(Reverse((cost, current, parent))) = queue.pop() {
10199
for &(next_parent, next) in current.neighbours() {
102100
let next_cost = cost + dir_matrix[parent as usize][next_parent as usize];

0 commit comments

Comments
 (0)