Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 4.03 KB

README.md

File metadata and controls

19 lines (13 loc) · 4.03 KB

My solutions to Advent of Code puzzles.

Advent of Code

In this repo, I'll gather solutions to the famous yearly challenges of Advent Of Code. If you don't know it, go ahead and visit the website, you'll not regret it if solving funny algorithmic problems as quickly as you can is something that thrills you.

In short, each year, while waiting for Christmas, you're given one problem a day for 25 days. Your goal is to solve the puzzles with any of your preferred programming language. Some don't even use a programming language and manage to solve some puzzles with VIM! Solving a problem is great, and that is already a reward in itself. But the real challenge is to be one of the first persons to give the right answer and put your name on the leader board.

Note, the primary goal is not to get a code that takes the least time to compute the answer, but to get the answer as quickly as possible. Coding two hours to produce a solution that computes the answer in 20 ms, does not get you as close as a code written in 30 minutes that gives you the answer in 2 seconds. Of course, it is still a nice exercise to write a code that find the answer as quickly as possible. However, it is also a very good exercise, sometimes more important, to write a clean nice readable code, that would not be as efficient but still gives the answer in a reasonable period.

My solutions are probably standing in between. When solving past challenges there is of course no real time pressure in writing the code but you have to aim at this in order to be able to pretend to the leader board for the future challenges. More details is given case by case.

My own experience

I only discovered Advent Of Code in December 2019. So, I'm a beginner in that sens. I first started by developing solutions in Java ... because that was the language I used the most at that time. I managed to solve most of the problems of that year, but of course, I was never not even close to figure on the leader board (note also that I live in Belgium, and I would have to wake-up quite early for that). Now is the Covid-19 crisis, and I have some more time at home to come back on those puzzles.

In this repository, you'll find solutions in C++, Python3 and Rust. Why those languages ?

  • I want to keep practicing programming in those three fantastic languages. At my work place at the moment, Java is mainly used. Those puzzles help me stay uptodate with those 3 languages.
  • C++ is the first languages I used for real work during my PhD in physics. I started right away with C++11 at that time. Now is 2020, and C++20 is almost there, but C++14 and C++17 are of course well established also. Solving puzzles in C++ is therefore a fun way to used latest C++ features. Those problems also give you a perfect environment to discover the STL content.
  • Python3 is another language is used during my PhD. The difference with C++ goes without saying. That is a good reason to solve the same puzzles. The approach is often a bit different mainly due to the enormous high level features available in Python3. Advent of Code in Python3 gives you the possibility to exercise with Python3 specific features such as list comprehension, heavily used in solving such puzzles. Also, the famous Numpy library often finds its place in Advent of Code. You're knowledge of this library will only get better. Finally, and maybe the most important point, Python3 seems to be the best language, in my opinion, to solve Advent of Code as quickly as possible. You'll be able, in few lines of code, to get to the answer.
  • Rust, probably one language that will stay for long. Its approach to solve common mistakes down in C++, such as the ones related to memory management is beautiful. It's quite a recent language and is still evolving quickly. Rust will not be the number one choice to quickly get to the answer. And that's ok, because it is not the goal of Rust. It will take some more lines before giving you the answer in a time comparable to fast C++ programs. Practicing Rust is my main goal in providing solutions in that language.