2 ms·
This was also roughly the idea I used; if you squint it comes down to a BFS and as such can use a lot of memory. My solution was to fix the first few digits (as
by WJW 5y ago
This was also roughly the idea I used; if you squint it comes down to a BFS and as such can use a lot of memory. My solution was to fix the first few digits (as in the article) and then run the VM in parallel over the remaining digits, combining solutions (because the have the same internal state) as it goes. If you do this for all the allowed permutations of the first few digits then you must have covered the entire search space.
I don't really understand how the "early out" logic works but that would have been pretty nice. My solution didn't have that and took quite a bit of time.