Advent of Code 2023 (Day12)

Advent of Code 2023 (Day12)


Rust

This is my first time to tackle Advent of Code and I found it very challenging at some points so far.

I solve them in Rust as that’s the language I want to sharpen now. Every problem starts with parsing text from given input. And it’s very good practice because I haven’t done it many times before.

I have just solved day 12 and would like to share it.

Day12

From the problem description and given inputs we can see this is probably a DP problem (…right?). So I first tackle it without memoization, and then incorporate HashMap to make it speed up.

In this problem, luckily, I managed to solve it without any issue. My programs takes a few seconds to finish for the part2. And when I disabled DP in it, it takes forever!

Here is my code.

Thanks for reading ✌️

© 2024 Hiro