AoC# 2024 - Day 11: Plutonian Pebbles

1 minute read

It’s Advent of Code time 🎄

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill levels that can be solved in any programming language you like.

As I’ve attempted these challenges for a few years now, I like to say that it teaches you how to recognise exponentially expensive problems (that is, those that brute force can’t solve). Day 11 is one of those if we tried to maintain a string of number changing pebbles…

Part 1 ⭐️

A simple list of the pebble numbers worked fine, albeit taking about 1 second to compute.

Part 2 ⭐️

I wan’t sure why the instruction “[the pebble] order is preserved” was relevant so I thought it might be important for Part 2, but instead we were asked to loop over the other-worldly pebble mutation 3×.

I was, however, pretty sure my Part 1 solution wouldn’t complete in any sensible amount of time1, so I thought a Dictionary of pebble numbers and counts might work. The result was correct and I’m still left wondering why the order was important2… can’t say I’ve seen a red herring in these challenges before 🤷‍♂️


  1. Certainly not longer than it took to implement the Dictionary method 😉 

  2. Indeed - my non-order preserving Dictionary method gives the same result for Part 1, and in 4ms compared to 1sec. 

Updated: