--- Day 12: Presents ---

December 12

Listening to: christmas lofi music🎄cozy radio to get festive to


For me, it's the 20th, and it's the first day of a 2 week holiday break. I've finished all of my shopping, sent out cards and gifts. I feel relaxed.


Okay for real, I spent about 30 minutes just trying to fix my parsing, which for some reason kept failing on an index-out-of-range error... turns out I had just upgrade my local .NET version from 6.0 to 10.0, but I hadn't upgraded my tools to run it from the bin/net10.0 instead of bin/net6.0 and it was causing weird debugger issues.

Once I got that running, I realized an easy shortcut, where if I just looked to see how many 3x3 slots existed, and checking if there's enough room for each present to get it's own full 3x3 slot.

private static bool CanFitPresentsSimple(Tree tree)
{
    int tiles = (tree.length / 3) * (tree.width / 3);
    return tiles >= tree.neededPresents.Sum();
}

Just on a whim, I tried that, and it gave... a convincingly close result on the full input. So on a second whim, I just submitted that, and...

That's the right answer! You are one gold star closer to decorating the North Pole.

Neat. That... that's it.

There's no part 2, no tetris-like puzzle solving, no DFS for fitting presents in to place. It's just done.


Time taken: 40 minutes

My solutions for today's puzzles