It is based on the premise that the longest target length is 4, and we might "waste" the first 2 steps for finding a good entry point. So we can discard all the sequences that doesn't match any target when the sequence length is 6.
Also, several optimizations are added (such as using string instead of array).
When solving a 7 * 7 matrix, the speed is improved from 5000ms to 60ms
Fix https://github.com/govizlora/optical-breacher/issues/22
I added a pruning step at the sequence length 6.
It is based on the premise that the longest target length is 4, and we might "waste" the first 2 steps for finding a good entry point. So we can discard all the sequences that doesn't match any target when the sequence length is 6.
Also, several optimizations are added (such as using string instead of array).
When solving a 7 * 7 matrix, the speed is improved from 5000ms to 60ms