Skip to content

Commit

Permalink
add comment for day 5
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-schaaf committed Dec 7, 2024
1 parent ce5dff3 commit ac45201
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
- Learnt about the `Vec::windows` method, that returns an iterator over a window of given size. So you can just `.map` over it using an anonymous diff function to calculate the gradient array.
3. [Solution](https://github.com/alex-schaaf/adventofcode2024/blob/main/day03/src/main.rs). Simple regex parsing. This time I learned more about how to implement functions that return an `Option<T>`. Combined with the `?` shorthand for propagating errors, this makes for really nice happy-path coding without the verbosity that you see in Go code.
4.
5.
5. [Solution](https://github.com/alex-schaaf/adventofcode2024/blob/main/day05/src/main.rs). Nice! I liked that I could just use the count of a given page number in the valid rulesets to determine the ordering! At first I thought I'd need to iterate a lot more.
6. [Solution](https://github.com/alex-schaaf/adventofcode2024/blob/main/day06/src/main.rs). Had fun over-engineering this by implementing a `Vec2d` struct, that represents a 2D vector as a 1D vector. First time I did OOP in Rust, so lots of things to learn here. Haven't started on Part 2 yet, though.
7. [Solution](https://github.com/alex-schaaf/adventofcode2024/blob/main/day07/src/main.rs). I got a bit annoyed here with Rust, as creating the cartesian product of operators felt like an unneccessary hassle to get Rust to do what I wanted it to do. A stark contrast to Python's `itertools`. Also first time in my life I had to deal with an integer overflow, because I was using first `i32` for the calculations, but it required `i64`. Thankfully Rust just tells you that when trying to parse a stringified number.

0 comments on commit ac45201

Please sign in to comment.