Last 12 weeks · 0 commits
2 of 6 standards met
Hi @BurntSushi 👋 First, I want to send thanks for sharing these Advent of Code solutions. Having a set of idiomatic solutions is very motivating as I teach myself Rust and work through these exercises 🎉 As I was solving the problem for Day 4, I was curious why you chose to use a for instead of an array. Since the minute that a guard can be asleep is limited to 0-59, wouldn't an array of is a better representation? It seems like using an array instead of a HashMap ensures that we limit the possible minutes that the guards can be asleep to 60, thus enforcing the principle of "making illegal states unrepresentable". To help clarify this idea, I refactored the hashmap for in this PR, and tested the inputs to ensure there were no regressions: aoc04$ cargo run part 1, product: 240 part 2, product: 4455 aoc04$ cargo run part 1, product: 19830 part 2, product: 43695 Perhaps I'm missing something, but it seems like this PR structures the data into a better representation? Or maybe this is just a trivial change? Either way, I would love to hear your thoughts 🙏
Repository: BurntSushi/advent-of-code. Description: Rust solutions to AoC 2018 Stars: 478, Forks: 27. Primary language: Rust. Languages: Rust (99.8%), Shell (0.2%). License: Unlicense. Open PRs: 0, open issues: 0. Last activity: 5y ago. Community health: 42%. Top contributors: BurntSushi, schubart.