this was a simple problem in the sense that they were looking for a specific optim that was easy to guess than prove that it was needed.

It’s one of those brute force problems where the search space “happens” to not be too bad, even worse one of those types as the search space easily exceeds but a subtlety in the problem makes the args that it is so.

Noticing that the last arg needs no iterating over seems like a constant factor optimisiation but is crucial here. And to be honest, I think we should do these optims even in general since they are “free”; some premature optims are really free.

The bound on solutions

can be determined in from the prefix, my argument was that it should not matter much if we go ONE level deep, I mean what’s 10 from 11; it’s a “will fail” case either way is what I had in mind.

’s coeff is 1, so you can always adjust and to find a solution. Say prefix has remainder , , set and to make a valid solution.

Note that for each such value of in a , what all mappings can I have, it’ll be as and mapping would map to a prefix we need to evaluate.

So,