Skip to content

Commit

Permalink
Fix handling of duplicate digits in 2024 day 21
Browse files Browse the repository at this point in the history
and remove unused variable
  • Loading branch information
ictrobot committed Dec 21, 2024
1 parent 7503d94 commit f2cb83c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/year2024/src/day21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ impl Day21 {
let mut queue = BinaryHeap::new();
for start in NumericKeypad::ALL {
queue.push(Reverse((0, start, DirectionalKeypad::Activate)));
result[start as usize][start as usize] = 0;
let mut best = [u32::MAX; NumericKeypad::LEN];
best[start as usize] = 1;
result[start as usize][start as usize] = 1;
while let Some(Reverse((cost, current, parent))) = queue.pop() {
for &(next_parent, next) in current.neighbours() {
let next_cost = cost + dir_matrix[parent as usize][next_parent as usize];
Expand Down

0 comments on commit f2cb83c

Please sign in to comment.