Published a YouTube video
Hosted a live stream on Twitch
Used Rust
+1
Live streamed a new episode of solving advent of code in Rust

Advent of code in Rust - solving day 7/2021 and day 8/2021 part 1 (Twitch Live 2022-03-7)



https://www.youtube.com/watch?v=aKZ6VbrIC50

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/pr...) 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