Advent of Code 2022 — Sharing our experiences

Criteo R&D
Criteo Tech Blog
Published in
7 min readJan 17, 2023

In Criteo, we are passionate experts, but there is always more to learn. That passion motivates us to actively participate in code challenges such as Advent of Code. Join us along for this last 2022 edition journey.

Photo by Elena Mozhvilo on Unsplash

What is Advent of Code?

As Eric Wastl, the creator of AoC, explains on its website:

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them for interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.

You don’t need a computer science background to participate — just a little programming knowledge and some problem-solving skills will get you pretty far. Nor do you need a fancy computer; every problem has a solution that completes in at most 15 seconds on ten-year-old hardware.

2022 was the 8th edition, and a bunch of our Criteos was involved day after day. Specifically, we had 53 people that solved at least one of the challenges. Our private leaderboard perfectly reflects motivation and engagement. We ended up with the following results:

Criteo R&D private leaderboard
Criteo’s R&D private leaderboard

There was a Slack channel where people shared their thoughts (and spoilers) daily. It’s incredible how an initiative like AoC can create that atmosphere. Everyone was quite active and loved discussing the daily problem. That channel was on fire all the time 🔥

Fun fact: Do you want to know which programming languages were used?

Programming languages used by Criteos
Programming languages used by Criteos

Experiences from our Criteos

Let’s now share some personal experiences from people inside R&D. We asked them questions about their participation in the AoC.

Photo by Etienne Girardet on Unsplash

What has been the challenge that you like the most and why?

Day 19 was the favorite one for Ines Amiji, Senior Software Engineer: “It was fairly challenging, but I was able to reuse some of the concepts I learned doing a previous puzzle (day 16) which made me feel like I was learning something / getting better at those types of problems. It also required thinking about the problem at hand and making a few key observations for solving the problem in a reasonable period of time.”

For Grégoire Seux, Engineer Manager, day 24 was his favorite: “The problem was simple and clear. It was even a bit poetic to imagine the elves in a valley, walking in the middle of a blizzard.” And, for Alexandre Conte, Software Developer Engineer, it was day 14: “The challenge for that day was a simulation of sand by cellular automata (like the game of life), which gives super interesting visualizations!”.

Being challenged is really in our culture, and Hai-Nam NGUYEN, Software Developer Engineer, reflects that choosing day 17 as his favorite one: “Part 1 was straightforward, but part 2 was quite hard. You know some kind of cycle exists, but you can’t find them. It was on Saturday. I spent about an hour and a half on this challenge, then decided to stop and run (I run every morning). I spent another hour during my running thinking about some mathematical formula but couldn’t find anything feasible. In the evening, I checked our Slack and saw someone saying they had learned a new algorithm: cycle detection. I implemented it, and even not being 100% correct, it worked. It’s what you expect in AoC: you find a numerical answer, not a perfect algorithm, and when it’s good enough, it’s good for AoC. I love this principle.”

What has been the challenge for difficult and why?

Remember that Ines loved day 19? Hai-Nam did not: “I even couldn’t solve part 1. My first solution takes several minutes and gives the wrong result in one of the two example inputs. During the day, we discussed several optimizations in our Slack, but my implementation was still wrong and slow. It’s basically a branch and bound technique. However, my recursive approach makes it much more complex than it could be. 24h have passed, and I read a solution, a very clean implementation using deque in Python, and tried to fix my implementation, but it was still quite complex and buggy. I abandoned and thought that on the 25th, I would copy a solution to have my answer.” But, wait for it… “Luckily, on the 24th, we had a similar and, in my opinion, much easier challenge. I solved it quite quickly using the clean technique that I learned earlier. I was so excited that in the evening, just before the Christmas Eve party, I almost rewrote my implementation for day 19 and got the correct answer for both parts. What a challenge!” 🚀

For Ines and Alexandre, day 16 was tough: “The challenge involves a lot of micro improvements before getting the nearly naive solution to have a respectable duration (around the minute).”, Alexandre says. Ines adds: “My initial approach was much too slow to solve the problem. I had to look at a couple of solutions to understand how to tackle part 1. I did learn a lot from completing day 16 and was able to re-use what I learned from a couple of other problems.”

Grégoire mentions another one, day 17: “That day was not fun for me. I spent a lot of time on part 1 to write code that would be able to deal with rotating pieces because I thought it would be the new challenge of part 2. It was not, and most of my anticipation had been useless. I had not enough courage to work on part 2 and gave up.”

Hai-Ham’s cube for day 22.
Hai-Nam’s cube for day 22.

Did you learn something new?

Ines: Yes! Some were small Python-specific things (you can specify a start index for enumerating and create your own comparison function that you can then pass on to sort). Others were more conceptual, like using recursion + caching to solve complex optimization problems.

Hai-Nam: Yes, a lot. Like the cycle detection algorithm, clean implementation using a queue instead of recursion, and many interesting discussions in our Slack channel.

Alexandre: I learned a few of Kotlin’s SDK methods and also brought my algos knowledge faster by comparing similar problems

Grégoire: I started to learn Rust on Dec 1st, so the first days were unusually hard for me until I discovered enough of the language.

Why did you participate? How would you encourage people to participate in the following editions?

All of our Criteos had lots of fun participating in the AoC and highlighted that one continuously learns something new. That’s also part of our DNA at Criteo.

It was not the first edition for Ines: “I participated in Advent of Code last year and really enjoyed doing it. I always learn something new every year that I carry with me onto the next. The puzzles are fun, cover a variety of different topics, and range from being fairly easy to quite hard. For newcomers, I would recommend trying to solve problems at your own pace without worrying about completing all puzzles on time. If you want a dose of healthy competition to keep you on track, join the leaderboard!”.

And Hai-Nam loved the format: “It’s less than a month-long, the daily problem has different difficulties, and it does not always increase day after day. It’s well suited for me, and I happen to have an hour or two free every day in December :-) If you like being challenged, reading stories, and coding, 30 minutes is enough to solve the challenges of the first days.”.

Greg’s day 14 visualization.
Grégoire’s day 14 visualization.

Ok, ok, stop talking… show me the code! 💻

Sure thing! Check out the solutions that our Criteos uploaded to GitHub for this last 2022 Advent of Code: Ines, Alexandre, Grégoire, and Hai-Nam.

Did you like the article? Would you like to be part of this incredible team? This article is an excellent example of our culture and values. Check our website to learn more about us and our positions.

--

--

Criteo R&D
Criteo Tech Blog

The R&D team building the Commerce Media Platform for the Open Internet.