diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-30 22:46:45 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-30 22:46:45 -0700 |
commit | 3d57434c04a669610d5f15bd2a7713e6928cdef7 (patch) | |
tree | a0f1f04a335bbc808369d6492f4fee2ff06a0bdb /day-05 | |
parent | 59966ade163a39fc03f07a9d905e0bd87a98d60c (diff) | |
download | aoc-3d57434c04a669610d5f15bd2a7713e6928cdef7.tar.gz aoc-3d57434c04a669610d5f15bd2a7713e6928cdef7.zip |
add aoc2023
Diffstat (limited to 'day-05')
-rw-r--r-- | day-05/.gitkeep | 0 | ||||
-rw-r--r-- | day-05/sol.exs | 28 |
2 files changed, 0 insertions, 28 deletions
diff --git a/day-05/.gitkeep b/day-05/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/day-05/.gitkeep +++ /dev/null diff --git a/day-05/sol.exs b/day-05/sol.exs deleted file mode 100644 index e1dab2b..0000000 --- a/day-05/sol.exs +++ /dev/null @@ -1,28 +0,0 @@ -defmodule Solution do - def solve(input, chunk) do - (String.split(input, "", trim: true) - |> Enum.chunk_every(chunk, 1, :discard) - |> Enum.map(fn window -> - Enum.reduce(window, %{}, fn char, acc -> - Map.put(acc, char, Map.get(acc, char, 0) + 1) - end) - end) - |> Enum.find_index(fn letter_counts -> - Enum.all?(letter_counts, fn {_key, value} -> - value == 1 - end) - end)) + chunk - end - - def main do - input = File.read!("input") - - solve(input, 4) - |> IO.inspect() - - solve(input, 14) - |> IO.inspect() - end -end - -Solution.main() |