woolfred
Advent of Code 2022 - Day 1
Most Liked
woolfred
Here is my first attempt, which uses specific reduces for the task at hand: advent-of-code/elixir/lib/aoc22/day01.ex at b4357a22f3a53bb46e4a98852eef4049ab1b1ec6 · woolfred/advent-of-code · GitHub
Afterwards I refactored it a bit, which makes it less efficient for Part 1, but favours readability:
https://github.com/woolfred/advent-of-code/blob/master/elixir/lib/aoc22/day01.ex
5
egze
There is a leaderboard from last year that we can reuse. (shared with users of Erlang Forums ) /cc @bjorng
https://adventofcode.com/2022/leaderboard/private/view/370884
The entry code is:
370884-a6a71927
5
pesnk
I used a very naive approach, I believe using chunk can turn out to be a better solution
Part 1
String.split(input, "\n\n")
|> Stream.map(fn(x) ->
String.split(x)
|> Stream.map(&String.to_integer/1)
|> Enum.sum()
end)
|> Enum.max()
Part 2
String.split(input, "\n\n")
|> Stream.map(fn(x) ->
String.split(x)
|> Stream.map(&String.to_integer/1)
|> Enum.sum()
end)
|> Enum.sort(:desc)
|> Stream.take(3)
|> Enum.sum()
5
Popular in Challenges
This topic is about Day 17 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/l...
New
Reasonably pleased with my solution. The bitstring packet problems are so well suited to Erlang/Elixir it’s almost not fair.
defmodule D...
New
This topic is about Day 18 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/l...
New
This topic is about Day 16 of the Advent of Code 2021.
We have a private leaderboard (shared with users of Erlang Forums):
https://adve...
New
Note: This topic is to talk about Day 10 of the Advent of Code 2019 .
There is a private leaderboard for elixirforum members. You can jo...
New
Here is my solution:
https://github.com/bjorng/advent-of-code-2021/blob/77bdef7a51b428b58ffb4ab76f540901e636f841/day12/lib/day12.ex
New
Today’s problem is really tense. I don’t think I can do it without libgraph.
New
A frustrating one for me. I spent a long time trying to understand why some combinations resulted in fewer presses and struggled to keep ...
New
New
This one was much easier for me than yesterday’s. Part 1 runs in 22ms and part 2 runs in ~3s.
defmodule BridgeRepair do
def parse_inpu...
New
Other popular topics
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help.
Where are they similar?
Where do they differ the m...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition)
It’s been a while since we first asked this, I...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something…
Haskell reminds me of Java, and e...
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
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









