summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/day09.exs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/day09.exs b/src/day09.exs
index 1e37cad..b8164e4 100644
--- a/src/day09.exs
+++ b/src/day09.exs
@@ -57,6 +57,11 @@ defmodule Day09 do
defp locations(acc \\ [], revfiles, spaces)
+ # a (block size), b (block position), i (block index)
+ # c (space size), d (space position)
+ # IMPROVE ME: since there are at most 9 sizes, we could keep the
+ # locations of the spaces in a tree for each size, and achieve
+ # better performance, might do it later..
defp locations(acc, [{{a, b}, i} | t], spaces) do
spaces = Enum.filter(spaces, fn {_, d} -> d < b end)