Advent of code in Rust - solving day 25/2020 & day 1/2021 (Twitch Live 2022-01-10)
In this episode, we finally completed the last day of Advent of Code y2020!
This one was a short exercise involving some cryptographic brute forcing. Nothing too tricky, that we just solved with 2 functions and with one simple loop each.
If you know any interesting mathematical solution that would allow us to avoid the loops (or reduce the amount of brute force) please let us know!
After that we started year 2021. We had already solved exercise 1 during the xmas break so we just discussed our solution and explored a couple of alternative solutions.
Our original solution used the crate itertools:( https://docs.rs/itertools/latest/itertools/ ) and specifically the tuple_windows method ( https://docs.rs/itertools/0.10.3/itertools/trait.Itertools.html#method.tuple_windows ).
Then we explored two alternative solutions. One with building our own `Pairs` iterator and another one using the `zip()` method of iterators (https://doc.rust-lang.org/std/iter/struct.Zip.html).
We finished the episode by running some benchmarks and see that the custom iterator was the fastest solution (just slightly after itertools).
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