Solving day 9 of Advent of Code 2022 in JavaScript

preview_player
Показать описание
Advent of Code is a website that releases a new programming puzzle every day between the 1st and the 25th of December.

0:00 Parsing
2:57 Part 1
21:06 Part 2

Have fun!

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

I have been loving these videos as a helping hand when I have been stuck! Really easy to follow and love seeing your thought process

granttapp
Автор

I really liked how clean your solution was with the class and the functions for the points.

queuebit
Автор

Making move and follow a class is genius!

gixxerblade
Автор

To get last element we can use .at(-1). Love this one. We have this in Node 16.6.0 upwards

thilina
Автор

24:55 I've got an answer to this question: I could have written knots.at(-1) to get the last element of the array!

thibpat
Автор

Hey.

As I see your videos is cool and in this year)

About how to get last element of array:
or use variable typo as `const lastIndex = array.length - 1;`
or use method at of array (this is right way for access to elements of reference type and/or in the case when length of array is constantly changing) `const lastElement = array.at(-1);`

lordkim
Автор

Today I learned about "manhattan distance". Thanks!
I just used Math.hypot(x, y) > 2.

queuebit
Автор

Hey thibpat. Thanks for the video.

I looked through your code and it seems very similar to my solution but I get 2521 as a result with my input while your solution gets 2485 (which is correct). I don't know what I'm missing as the results seem very similar too. Could you take a quick look at my solution maybe?

EnesKaplanDev