2020 advent of code - day 10 solutions

preview_player
Показать описание
part 2 was extremely trick on this one! I show two different ways to solve it :)

==========

I won't ask for subscriptions / likes / comments in videos but it really helps the channel. If you have any suggestions or things you'd like to see please comment below!
Рекомендации по теме
Комментарии
Автор

The sorting could be done in O(n) by putting all numbers into a dict, set some variable x=0, check if x+1 or x+3 is in the dict, append accordingly x+1 or x+3 to the list and update x+=1 or x+=3 accordingly.
The second solution is just a general solution for many problems of that kind. If you know the trick you can apply it to many coding problems (especially with graphs or such number lists)

LB-qrnv