Skip to content
/

My Advent of Code 2021

Although Eric Wastle has been organizing the Advent of Code since 2015. I only discovered it recently when some colleagues invited me to join the 2021 edition.

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.

About

During the first 25 days of December, the challenges made me (re)discover many possibilities with C#, some that are long available but maybe not that well known.

Solutions

I had a blast (and some frustration ;)) solving the challenges, starting early morning, every day.

Some of the noteworthy concepts I have used:

  • Records, both class (C# 9.0) and struct (C# 10.0) based
  • Converting data (bits to int with bit shifting, char to decimal using addition or subtraction, etc.)
  • Efficiently read and slice strings, arrays, and lists using Index and Range (C# 8.0)
  • Work with Stack<T> (.NET Framework 2.0), SortedSet<T> (.NET Framework 4.0), and HashSet<T> (.NET Framework 4.7.2)
  • Using init only setters, with expressions and target typed new expressions (all C#9.0)
  • Many, many more...

I have put all my code and descriptions in my AdventOfCode2021 repo on GitHub. I hope this might inspire you to discover a feature you were not aware of yet!