Advent of Code Day 12: Packaging Presents

On Day 12 of Advent of Code, we’re helping to place presents under trees for Christmas. Basically, we’re playing Tetris.

After yesterday’s struggle, my first reaction was thinking it must be something simple instead of brute-forcing positions and rotations plus backtracking.

My first rationale was checking if the areas of presents was less than the available area. 7*numberOfShapes < width*height. By looking at other solutions, it seems that was enough.

This last puzzle felt…weird? I knew there was a simple solution after the struggle of previous days. And after looking at others’ solution, I feel like I missed the class on packaging algorithms. Everybody mentioned them in the solutions.

Today is another bearly voilà.

Advent of Code sharpens your coding skills. But coding is more than typing symbols fast. It’s also about teamwork, collaboration, and many skills I share in my book, Street-Smart Coding: 30 Ways to Get Better at Coding. That’s the roadmap I wish I’d known from day one.

Get your copy of Street-Smart Coding here