Mo :ferris: :tux: @ FOSDEM on Nostr: #AOC: Day 9 was fun again. Part 2 was surprisingly easy in Rust 😂 Mean time ...
#AOC: Day 9 was fun again. Part 2 was surprisingly easy in Rust 😂
Mean time (including parsing):
Part 1: ~50µs
Part 2: ~50µs
All you had to add for part 2 is `.rev()` to your iterator over the input sequences.
Iterators are very powerful 🚀
https://codeberg.org/mo8it/advent-of-code-2023/src/commit/02c172d55894f3f72afa10f37e26b931f9c5c01d/day9
- No dependencies 📦️
- <65 lines of code 🤏
You could use even less code if you just use the `parse` function on a string. But I wanted to optimize it 😛
#RustLang #Rust
Mean time (including parsing):
Part 1: ~50µs
Part 2: ~50µs
All you had to add for part 2 is `.rev()` to your iterator over the input sequences.
Iterators are very powerful 🚀
https://codeberg.org/mo8it/advent-of-code-2023/src/commit/02c172d55894f3f72afa10f37e26b931f9c5c01d/day9
- No dependencies 📦️
- <65 lines of code 🤏
You could use even less code if you just use the `parse` function on a string. But I wanted to optimize it 😛
#RustLang #Rust
