diff --git a/bin/day2416.ml b/bin/day2416.ml index a5bd505..21c4cd8 100644 --- a/bin/day2416.ml +++ b/bin/day2416.ml @@ -119,9 +119,7 @@ let part2 (grid, start_pos) = let rec impl acc lst = match dijkstra (visit_max grid visited_grid) (check_end grid) lst with | None -> acc - | Some (_, states, remainder) -> - List.iter (fun x -> visited_grid.(visited_idx grid x) <- 0) states; - impl (states :: acc) remainder + | Some (_, states, remainder) -> impl (states :: acc) remainder in impl [] [ (0, [ ((1, 0), start_pos) ]) ] |> List.concat |> List.map snd |> List.sort_uniq compare |> List.length