{"id":25072535,"url":"https://github.com/cr0t/advent-of-code-2015","last_synced_at":"2025-03-31T17:47:03.580Z","repository":{"id":136839834,"uuid":"576709424","full_name":"cr0t/advent-of-code-2015","owner":"cr0t","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-01T22:41:37.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T22:33:09.049Z","etag":null,"topics":["advent-of-code","advent-of-code-2015","advent-of-code-2015-elixir","elixir","livebook"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cr0t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-10T18:15:11.000Z","updated_at":"2024-12-01T22:41:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"046cb88a-e25a-4896-96b6-753ca71be955","html_url":"https://github.com/cr0t/advent-of-code-2015","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0t%2Fadvent-of-code-2015","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0t%2Fadvent-of-code-2015/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0t%2Fadvent-of-code-2015/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr0t%2Fadvent-of-code-2015/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cr0t","download_url":"https://codeload.github.com/cr0t/advent-of-code-2015/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246512211,"owners_count":20789657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code","advent-of-code-2015","advent-of-code-2015-elixir","elixir","livebook"],"created_at":"2025-02-06T22:29:56.113Z","updated_at":"2025-03-31T17:47:03.553Z","avatar_url":"https://github.com/cr0t.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advent of Code 2015\n\nSolutions written in Elixir as [Livebook](https://livebook.dev/) notebooks.\n\n## Notes\n\n### Day 1: Not Quite Lisp\n\nPart 1 solved with `Enum.reduce/3` with multi-clauses function, and pattern-matching. 2nd part solved with `Enum.reduce_while/3`, multi-clauses function, pattern-matching, and guards.\n\n### Day 2: I Was Told There Would Be No Math\n\nPart 1 solved with `Enum.reduce/3`, `Enum.min/1`, and simple arithmetics. 2nd part solved in a very similar way, just another set of calculations.\n\n### Day 3: Perfectly Spherical Houses in a Vacuum\n\nPart 1 solved `MapSet` and `Enum.reduce/3`; in the accumulator we store visited coordinates (houses) and current one, every step we update the current coordinate according too rules.\n\n2nd part solved in a very similar way, but we just have to track coordinates of both Santa and Robo, and use two clauses in the reduce cycle; to simplify the code, we extracted new coordinate calculation to a module.\n\n### Day 4: The Ideal Stocking Stuffer\n\nPart 1 solved with pattern-matching on the first 20 bit of bitstring that get returned by `:crypto.hash(:md5, \"...\")`, plus a bit of recursion. 2nd part solved the same way (though initial solution got extended to check more bits in the head of a hash).\n\n### Day 5: Doesn't He Have Intern-Elves For This?\n\nBoth parts solved with `Regex`-es. Important to note that we rely on regex **back-references** to find pairs and repeatable groups. For example, `/(hello) \\1/ =~ \"hello hello\"`; here `\\1` refers to the first declared capture group `(hello)`.\n\n### Day 6: Probably a Fire Hazard\n\nBoth parts solved with quite straightforward `Enum.reduce` and `Map.update(map, key, default, fun)` approach. Maybe not very performant (part 1 get calculated in 26-27 seconds, part 2 in 33-34 seconds), but works. We do not initialize light grid, because we leverage `default` argument of `Map.update/4` function. Input parsed with `Regex.run/2` and pattern matching on matched groups.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr0t%2Fadvent-of-code-2015","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcr0t%2Fadvent-of-code-2015","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr0t%2Fadvent-of-code-2015/lists"}