8
[2015 Day 19] Help with an old one...
(adventofcode.com)
An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!
Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.
Everybody Codes is another collection of programming puzzles with seasonal events.
Solution Threads
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 |
Icon base by Lorc under CC BY 3.0 with modifications to add a gradient
console.log('Hello World')
Thanks for your thoughts! For the input data, I did notice that every substitution goes from 1 element to 2-8 elements. I suppose I could take that into account, and order them from "most efficient" to "least efficient", and that way I might be able to stop iterating earlier?
I also haven't looked into whether there are any combinations that are impossible to build from (or inversely to break down into
e).Those two are probably good avenues to try.
Thanks again!
That's not quite the key observation...
spoiler
Many of the productions end in an element which does not appear on the left-hand side. That acts as a flag which tells you where to look for substitutions.