This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of trying to see which combinations map to the desired outcome, | |
I did it the other way around: look at the desired outcome and stop as soon as we can't match. | |
E.g.: ?###???????? 3,2,1 | |
It HAS to start with a group of 3, so starting from the 1st, it could be possible, so I'd imagine that's a #. | |
However, that quickly rules it out as it then would be 4 consecutive # and we need to to start with a 3, so we can now safely | |
skip to position 1, the 1st #, and ignore all possible combinations for position 0 as they will not work. | |
Then, looking at position 1, we see we have exactly 3 #, so that could work, so we can try again, this time with a subset of |