LostKobrakai
This topic is about Day 9 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/leaderboard/private/view/39276
The join code is:
39276-eeb74f9a
Trending in Challenges
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
Todays challenge was mostly a matter of chunking data in a fitting matter for the questions asked:
https://github.com/LostKobrakai/aoc2020/commit/2734ef2469be42ebcffe9f09d5ce539a2521d608
Edit:
Used a little more time to actually use the proper type for the fifo accumulator needed in part 2:
:queue.https://github.com/LostKobrakai/aoc2020/commit/18dc68ea581b65183db492672bcdf12e5c49d57f
faried
The test input worked for my part 2, but the real input failed. I missed the bit about adding the smallest and largest values in my readthrough.
dams
I used gb_trees for part 1, shorten the code.
Part1
Part2:
hvnsweeting
Hello,
my first time post here, but I joined the board and solve AOC in Elixir since 2019. Last year I tried to do everything using tail-recursive but this year try to utilize more built-in function from Enum, such as
find_valueor comprehensions.adamu
Ahh,
:queueis pretty cool. I looked into:array, but didn’t think of queue, although that seems perfectly fitted for a sliding window.In the end I used lists, but implemented the sliding window with recursion to avoid inefficiently reading from / appending to the end of arbitrary-length lists.
Parts 1 and 2 complete in about a millisecond each, so I think it’s ok.
https://github.com/adamu/AdventOfCode2020/blob/main/day9/day9part2.exs
code-shoily
I know how that feels. I once had a situation where test input worked, my real input did not work, but inputs from my friends worked. Seems like there was a special case my input had which I did not take into account. Also, in yesterday’s solution, I had replaced “nop” and “jmp” both with “nop” and it still worked (I realized the typo later).
Anyways, staying true to the thread topic, here’s my solution for the day, nothing special, good old brute forcing
stevensonmt
I also took a brute force approach. I’m sure there is ample room for optimization, but after struggling so much with the last two days, I was just happy to be able to get this right away.
stevensonmt
umm, what? Is generating combinations really that simple? That’s brilliant.
kwando
This is the first version that worked, I later realized part 1 is a bit stupid and inefficient.. but I’m not in the mood to patch it up right now
ricardo-h
part 1 and 2 - O(n m)