Today was a good start! The problem was fairly standard and simple, expected for the first day. Turns out I remember almost nothing about how to use the Rust standard library and I had to lookup how to get the length of a vector (its `.len()`

).

Iterate over the list of provided numbers, keeping track of the previous (initialized to the MAX value), and increment a counter every time the current number is greater than the previous.

Convert the input lines into a vector, converting to integers along the way. From 2 to the length of the vector, iterate while keeping track of the previous sum, and increment a counter every time the current window `v[i-2] + v[i-1] + v[i]`

is greater than the previous.

This was another standard AOC problem, I think every year has several "grid movement from commands" types of problems.

Keep track of x position and depth. For each line of the input, split out the command and its value. Based on the command, increment/decrement the correct values. Multiply x and depth at the end.

Same as above but now up and down modify a new variable instead of depth, aim. Now, when moving forward, we update depth using aim and the current value. Multiply x and depth to get the answer.

Today was a grind. I could not shake the feeling that I was missing an obvious bit manipulation trick, but I eventually went on to using strings and vectors.

Loop over all of the numbers, keeping count of how which digit occurred more in each column. Go over the counts, and construct the bits back into two integers before multiplying them and returning the result.

The strategy here was iteratively remove numbers from the list until one was remaining. Each iteration would calculate the digit counts and then remove all rows that did not match the key so far. Do this for the first and second rule before multiplying them and returning.

Today was a mess. I am not experienced enough with parsing in Rust, and today's puzzle format amplified that. I also made the mistake of trying to mutate a struct/vec in a loop while using its iterator. This can't be done since it would require 2 mutable references to be alive at the same time. The easy solution is to fallback to a simple for loop that iterates an integer over the length of the array, then getting a mutable reference for each element on every iteration.

Parse out the draws and boards. Created a board struct with 2 methods. Iterate over the list of draws. For each draw, iterate over all boards. For each board, mark off (set to -1) the draw then check for Bingo. If there is a bingo, get the sum of all values that aren't -1 and multiply this sum by the draw number before returning.

Today wasn't bad at all! Parsing the input was straightforward and the problem itself was fine. I had some hiccups with using HashMaps in Rust, but didn't have any issues once I refreshed my knowledge on them.

Parse out each line into a start and end point. For each pair, skip if they are not on the same line. Then, iterate over the line and add each point to a `HashMap`

to count how many times we see the point. At the end, return the number of values in the hashmap that have a count greater than 1.

Same as above except for non-linear points, connect them with a line of slope 1 or -1, which can be determined by looking at their difference.

This puzzle was one of my favorite types of AOC problems, where part2 is just part1 but scaled up. This usually involves some kind of exponential growth and greatly punishes the naive approach. I suspect there is a straight numerical solution (this whole thing screams rings), but I'll search for that later since my solution is more than fast enough.

I back-ported my solution for part 2 here, but I initially implemented the naive approach. Parse the list of input numbers into a vector. For 80 iterations, look at each element in the fish age list. If the current age is 0, set it back to 6 and add a fish to the end with age 8. Otherwise, decrement the current age. Return the length of this array.

Instead of keep a list of fish directly, I instead chose to keep two lists, fish and new_fish. These vectors have length 7 and 9 respectively with the value representing the number of fish at the age represented by the index. So if `fish[2] = 12`

that means there are 12 2-day old fish. Using this, I can simply move over these vectors and "slide down" the groups of fish. I keep 2 separate lists due to the different age resets: a new fish starts at 8 and an old fish starts at 6. We perform the same shuffle and add between these lists in each loop before returning the sum of their sums.

These problems were fairly straightforward, but I messed myself up on some integer rounding. I picked up on some statistical values like median and mean being relevant, but didn't go with them on the first try. I ended up brute forcing both parts and getting my solutions before going back and optimizing my solution based on others posted online.

For every possible position, calculate the total cost and see if it is less than the minimum, saving if it is. Or, find the median and calculate the cost to it.

Same as above, except the cost function is the sum from 0 to x. Or, recognize this as the gaussian function `n*(n+1)/2`

and that the solution will be at either integer directly above or below the mean.

Merry Christmas!