Advent of Code - 2019 - Day 3-4

The fourth problem was about checking integer “passwords” for some somewhat strange properties. The straightforward solution looping over all integers and checking them one by one worked. But it was really slow (upwards of two minutes) - so in the end I decided to use one of the properties (digits must be increasing) to skip over many integers at the same time. This improved the solution a lot, and it now even fits in a single block (5.7M gas) and runs in about half a second.

My solution is here - this is the optimized version where a number of integers are skipped in one step.

With this solution we are in sync - let’s see what tomorrow’s puzzle will bring.

2 Likes