I Did a Coding Challenge for 25 Days, Here is What I Learned

Mayank Bansal
7 min readDec 30, 2020

“Any AoC fans in the house? ” one of my colleagues posted in our work slack #engineering channel with a link to Advent of Code 2020 (AoC 2020). Back in college, I used to do week-long coding challenges and then give up after 3 or 4 days.

AoC is a 25-day coding event that began in 2015. It starts 24 days before Christmas, with one puzzle released every day at 12:00 AM EST. Each day’s puzzle has two parts — you get one star for solving each part. At the end of the event, you can have up to 50 stars. The challenges increase in complexity from day one so that you can gather momentum. About 155K people participated in the event this year!

The timing of this challenge was perfect. I had just finished exploring leetcode to design a question for our intern recruiting this year. I already had the activation energy to jump into these challenges. So I thought, why not? After the roller-coaster that 2020 has been, this seemed like an excellent way to spend the 25 days up to Christmas!

Here are the 10 Things I Learned:

Disclaimer: I am not a competitive programmer, nor do I intend on becoming one. These learnings are just some notes I wanted to share as a rookie!

1. I Do Have the Energy and Time

I had almost convinced myself that I would deprioritize this or become lazy by day 7. I didn’t realize I could do this for 25 days straight. Yes, 25 days straight. AoC is the longest coding challenge I have ever done. Somewhere in the middle, I felt burnt out, but as always… you will always find words of gratuitous advice on Reddit.

“Sometimes, I feel like shit until my spaghetti code finally solves the problem. The whole challenge is to keep my pasta tasty along the way.” — uytv on Reddit

2. I Am Bad at Algorithms, and It Was Okay

Though all questions could be brute-forced, some would take ages. For many of the second parts of the puzzles, I did have to delete all my code and start over from scratch. Many common algorithms would’ve helped optimize time and space complexity. Through reviews and refactors, I learned a lot of dynamic-programming, graph theory, and algorithms naturally rather than forcing all those concepts down when interviewing. Some of the questions required the knowledge of an archaic algorithm or trick I wouldn’t have been able to come up with on the spot. Events like these are great for refreshing algorithms I once knew and learn new ones, especially with such a strong community of smart people who walk through their solutions and upload visualizations on YouTube!

3. Correctness + Learning > Speed

There will always be some college kid or someone who works at Facebook who will finish in less than 2 minutes. My best time was 10 mins, 48 seconds. So if I’m going to be slow, I might as well make sure I continue to learn, and I’m approaching the problem correctly.

Here is my favorite solution. This guy is living in the year 3000. His approach bamboozled so many people who didn’t know about the Chinese Remainder Theorem.

The ingenuity amazes me!

4. Speed Reading Is an Acquired Skill

The puzzles were disguised with a lot of story building text. Towards the final few days, I got much better at skimming the text — filtering the requirements out of the flowery prompt. Sometimes, I would miss one word that threw off my timing by 20–30 mins. Someone bought adventofrealizingicantread.com and redirected it to adventofcode.com.

5. I Need to Write My Notes

After a few challenges, I found out that people used utilities/examples from previous years in their solutions. I committed all my code in a repo on GitHub for my reference; maybe I’ll need it next year?

6. Reviewing Is Powerful

I enjoyed solving the questions, but then I found myself spending another 2 hours looking at how others solved it and then cleaning up my code and attempting to improve performance. Eventually, I got to a point where I could take the hint of how to optimally solve the puzzle from someone else’s solution thread and then implement it myself without having to read the implementation. I found that I learned the most while refactoring and reviewing my solutions after getting my two stars for the day. In retrospect, the practice of reviewing progress should not be limited to a contest — I look forward to reflecting on my day-to-day activities as well.

7. Choice of Language

Python is incredibly slow! Some people had C++ solutions, which took < 1 second; meanwhile, I was still waiting for my output 30–40 seconds later. I knew this, but Python did make my solutions so much easier to iterate on since my personal goal wasn’t to write the fastest solutions.

While solving the puzzle on Day-23, I realized that I could use hashmaps as linked-lists. If I used a class-based linked-list, there isn’t a one-line way to debug the whole list. Look at this example:

Class-based linked-list

Using a dictionary with unique ids saved me time while debugging inserts, deletes, and reorders.

Dictionary-based linked-list

The best language is your most comfortable one. I used Python despite being one of the slowest, but it remains my sharpest tool. Unlike me, many people use AoC to learn a new language. Maybe I’ll try out a new language next year!

willkill07’s one language a day project

8. Designing Puzzles Is Harder Than Solving Them

Back in college, I used to build an online cryptic scavenger hunt called CyberHawk and Hawkeye ❤️. We used to have around 1000 players every year. Typically, we would put up about 25 questions, but sometimes players could crack up to 40. I remember how hard it was to design questions every year so that they weren’t repetitive, and they weren’t too obscure to solve.

I have so much respect for Eric Wastl, the creator of AoC. He makes all the questions himself and generates all the inputs/outputs to have different test cases for everyone. It takes an incredible amount of time and energy to run an event like this. In my experience, the most challenging part of designing questions was to determine whether a problem was easy or hard. We faced a similar challenge in designing questions for our intern interview loop at work. Most questions will either seem too easy or too hard.

Gameplay from Cyberhawk 2015

9. Coding Puzzles Are Fun

I see these puzzles as brain food and problem-solving rather than knowing how to program. It’s even more fun and engaging to do with your colleagues or friends. We had a Slack channel with my colleagues to discuss solutions, hints, get help, and share our frustrations.

10. The Overall Event Experience Matters So Much

Compared to time-bound, performance-based contests on Hackerrank, CodeChef, and SPOJ, this event was much more enjoyable. Reading the submissions thread on Reddit was the highlight of the event. It was so heartwarming to see how much the event means to a lot of the participants. The memes, the visualization videos, the comments — all absolutely priceless. https://www.reddit.com/r/adventofcode/

People are crazy; here is a Day-1 solution in Intcode
Here is a Day-3 visualization

Interesting Stats

Since I completed all 25 days and spent so much time, I decided to compile some stats on my performance, mostly for posterity and absolutely no bragging rights?

Problem 1 (⭐ x 25 ) ️

Highest Rank:   731/156,525 (Top 0.5%) (All)
Average Rank: 8,816/156,525 (Top 5.6%) (All)
Average Rank: 3,348/156,525 (Top 2.1%) (Excluding late starts)
Median Rank: 3,569/156,525 (Top 2.3%)

Problem 2 (⭐ x 25 )

Highest Rank:   311/156,525 (Top 0.2%) (All)
Average Rank: 7,889/156,525 (Top 5.0%) (All)
Average Rank: 3,050/156,525 (Top 1.9%) (Excluding late starts)
Median Rank: 3,427/156,525 (Top 2.2%) (All)

My two favorite questions (because I couldn’t pick one):

Day-20: Jurrasic Jigsaw https://adventofcode.com/2020/day/20

Day-12: Rain Risk https://adventofcode.com/2020/day/12

I’m pretty happy with my Average Rank (Excluding late starts). I know this statistic is misleading and encapsulates my terrible punctuality for this event. But hey, he who writes the story gets to fudge the stats, right? Forgetting the ranks for a second, more than anything, I’m happy to say I am amongst the ~9,400 (6%) people who finished this 25-day marathon! I’ll take my finisher’s medal, please!

This meme sums up how I feel:

Overall, AoC 2020 was incredibly adventurous, frustrating, curious, and, most importantly, fun. On to the next thing!

Go eat some tasty pasta! 🍝

Comment below with your experiences doing coding challenges. If you have feedback or want to connect with me, please reach out on Linkedin. If you wish to interview prep for any software engineering roles at a big company, I’m more than happy to help! Follow me on Instagram to see what I’m up to! Learn more about me on my website https://manky.me.

Thank you Sukriti Paul for helping me edit!



Mayank Bansal

Frontend Engineering | Design | Fintech | Freight | Logistics | Immigration | Helping build finance solutions for freight carriers @Outgo ! Ex-Convoy 🦄,