diff options
author | HJ <thechairman@thechairman.info> | 2021-12-18 08:42:08 -0500 |
---|---|---|
committer | HJ <thechairman@thechairman.info> | 2021-12-18 08:42:08 -0500 |
commit | 8b89ab12d3a1e7d0d271978debe9e78e206b7ce6 (patch) | |
tree | 953be735ca256cf01f32d001c1de6c37447de518 /2021 | |
parent | dd25350524151cdbb0391e89486df977de4e6a62 (diff) | |
download | gleam_aoc-8b89ab12d3a1e7d0d271978debe9e78e206b7ce6.tar.gz gleam_aoc-8b89ab12d3a1e7d0d271978debe9e78e206b7ce6.zip |
day 15 Elixir version
Diffstat (limited to '2021')
-rw-r--r-- | 2021/day-15/day-15.livemd | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/2021/day-15/day-15.livemd b/2021/day-15/day-15.livemd index da734ff..2495c32 100644 --- a/2021/day-15/day-15.livemd +++ b/2021/day-15/day-15.livemd @@ -279,16 +279,6 @@ We repeat the same steps as before: building the graph, using Dijkstra's algorithm and summing up the risks along the best path. ```elixir -get_lowest_risk_path = fn nodes -> - with {{min_c, _}, {max_c, _}} <- Enum.min_max_by(nodes, fn {{i, j}, _} -> i + j end) do - nodes - |> then(make_graph) - |> Graph.dijkstra(min_c, max_c) - |> tl() - |> Enum.reduce(0, fn coord, sum -> sum + Map.get(nodes, coord) end) - end -end - get_lowest_risk_path.(expanded_floor_nodes) ``` |