- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Advent of code in Rust - solving day 7/2021 and day 8/2021 part 1 (Twitch Live 2022-03-7)
In this episode, we completed day 7 of Advent of Code y2021 using Rust! We also started day 8 of the same year and got as far as completing part 1 and doing some interesting benchmark tests to measure hashsets vs btreesets performance with a small set of numbers.
The first challenge wasn't too hard if solved with maths. The first part of day 7 required us to calculate the median, while part 2 was easily solved with average and the gauss formula to sum the first n numbers.
An interesting thing we learned is that with a Vec of integers we can use the function `select_nth_unstable` (https://doc.rust-lang.org/beta/std/primitive.slice.html#method.select_nth_unstable) to extract the median without needing sorting. This resulted significantly faster (about 25%) than sorting the vec (even with unstable).
Day 8 is much more challenging and it will require us probably a dedicated episode to go through part 2.
In this exercise we'll need to go to deduct mapping between cables and a led display that shows digits by looking at a series of measurement and proceeding by exclusion.
The first part was very easy because we just needed to count the occurrence of strings of a certain length in the input, but part 2 is where the magic will happen so stay tuned for that one!
If you have any suggestion, we'd love to hear it, so please leave a comment or a create a PR!
For all the source code check out the official GitHub repo: https://github.com/lmammino/rust-advent
For seeing the next episodes live check out our Twitch channel: https://twitch.tv/loige
Видео Advent of code in Rust - solving day 7/2021 and day 8/2021 part 1 (Twitch Live 2022-03-7) канала Luciano Mammino (loige)
The first challenge wasn't too hard if solved with maths. The first part of day 7 required us to calculate the median, while part 2 was easily solved with average and the gauss formula to sum the first n numbers.
An interesting thing we learned is that with a Vec of integers we can use the function `select_nth_unstable` (https://doc.rust-lang.org/beta/std/primitive.slice.html#method.select_nth_unstable) to extract the median without needing sorting. This resulted significantly faster (about 25%) than sorting the vec (even with unstable).
Day 8 is much more challenging and it will require us probably a dedicated episode to go through part 2.
In this exercise we'll need to go to deduct mapping between cables and a led display that shows digits by looking at a series of measurement and proceeding by exclusion.
The first part was very easy because we just needed to count the occurrence of strings of a certain length in the input, but part 2 is where the magic will happen so stay tuned for that one!
If you have any suggestion, we'd love to hear it, so please leave a comment or a create a PR!
For all the source code check out the official GitHub repo: https://github.com/lmammino/rust-advent
For seeing the next episodes live check out our Twitch channel: https://twitch.tv/loige
Видео Advent of code in Rust - solving day 7/2021 and day 8/2021 part 1 (Twitch Live 2022-03-7) канала Luciano Mammino (loige)
Комментарии отсутствуют
Информация о видео
8 марта 2022 г. 1:15:45
01:04:15
Другие видео канала




















