Advent of Code 2021 - Day 1

preview_player
Показать описание
In this video series, I try to challenge myself with the Advent of Code trials. Each solution will be published to Github, and I hope you will learn something from my coding mistakes and perhaps send some code my way on how you have done these challenges. I know by reading code, so this is such an exciting thing for me.

GitHub repository:

Unlock unlimited opportunities with 50% off your first month of Coursera Plus

Get on the fast track to a career in cybersecurity. In this certificate program, you'll learn in-demand skills, and get AI training from Google experts. Learn at your own pace, no degree or experience required.

Join the channel to get access to more perks:

Or visit my blog at:

Outro music: Sanaas Scylla

#aoc2021 #advent #code
Рекомендации по теме
Комментарии
Автор

Had those in my code interview yesterday as a junior web developer jop application.
3 people watching me solving it live in javascript.

rc-wingman
Автор

mate i cannot get my head around this LOL

mk-osgl
Автор

Hello Daniel, first of all sorry for my english.

I see that you iterate over the three A inputs (199, 200, 208), but I don't think this is necessary.

As we can see the element 2 (200) and 3 (208) of the array A will be the same of the 1 (200) and 2 (208) elements of the array B we only need the difference between the first element of A and the last element of B.

And we know that the fourth element will be the last element of B, so we could use only one array of 3 elements to store the first elements of the letters and use one variable to the fourth one.

I hope this can help

henriquetsuyoshiyara
Автор

I decided to just return my function with -1 on the count of increases instead of checking with a flag. Not sure how much faster that might be, probably negligible

gouf_respecter
Автор

Why check the number which gave 7 as output ?

santoshjackman
Автор

The first part could be done in 7 lines in python

neutron
Автор

Quick and easy file reading:

.map(Integer::parseInt)
.toList();

Jsmenzies