Skip to content

My solutions to the Advent of Code 2021

Notifications You must be signed in to change notification settings

danirod-live/aoc21

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AOC2021

These are my solutions for the AOC 2021 challenge.

Show must go on

This year I needed a vacation and thus I am not solving the problems every day. I'm solving problems every few days.

As usual I am streaming how I solve the problems, but this year I am not broadcasting the streams through <youtube.com/makigas>, but through <twitch.tv/danirod_>. VODs are available through Twitch VOD system and also reuploaded to my second YouTube channel here: https://www.youtube.com/playlist?list=PLf7Nw_MU4SewgNViz_W53O-eqNtYHfQXd.

Languages

I am using Ruby. Not the fastest language but I like it a lot and thus it makes me happy. Things that I've learned about Ruby thanks to this decision:

  • You can early return from a map block using next n to go to the next iteration. next accepts a parameter.

Some problems were solved in Golang, when it made sense - such as Ruby being slower than acceptable. First time this happened, I decidsed to translate the algorithm to a different language and the chat proposed to rewrite it in Golang. Then the next time it happened, I used Golang again to re-use the read file + cast to int logic.

  • Problem 06 - it is faster in Go
  • Problem 14 - I did this a lot of times until finding the correct solution, a wrong solution was done in Golang for performance reasons, did not want to go back to Ruby after designing a good algorithm
  • Problem 15 - because apparently solving a dijkstra with 250000 edges is too much for Ruby.
  • Problem 19 - because I don't want to optimize the solution, so at least this is faster I think

Problem 07 was solved in Microsoft Excel and thus the folder 07 contains an XLSX file.

I would want to solve them in Haskell but I could not care less about monads, so I am sorry.

About

My solutions to the Advent of Code 2021

Topics

Resources

Stars

Watchers

Forks