Coding and the Holidays. Advent of Code

I was recently introduced to the Advent of code. It’s an Advent Calendar of code challenges!

You get 25 days worth of little code challenges.

On the first day the challenge was

The puzzle input was a list of numbers. I decided to do the challenge in Javascript, but in hindsight it would have been a nice opportunity to try a new language.

I turned the puzzle input into an array.

Then I decided to shift the first item in the array and compare that variable to the rest of the items in the array. If the sum was equal to 2020, I would return the product of those numbers. If not, then I would repeat the function until I got my 2020 sum.

I got an answer of 913824

After submitting my answer I was presented with this screen.

SUCCESS!

I was a little late to the Advent of Code party, but at least I know it exists now and I can look forward to doing it next year from the start! Happy Holidays and have a Happy New Year!

Fullstack Software Engineer