While this is a "puzzle" rather than a programming task, I think it is actually a rather good interview question, as it tests a number of skills valuable in a programmer. If you can't solve this, then you may have a lot of trouble reasoning about complex code.
The first thing I noted is that i is initialized twice, so its initialization to 42 is irrelevant unless the second initialization is eliminated, e.g. by changing it to i + 0. The next thing I noted is that we're stuck with -- as it cannot be usefully modified by a single character. So we're decrementing a counter but using < for the test, so we need to do an inversion of some sort. -i < n does that handily, as does n-- by decrementing the limit rather than the counter. The i + n solution, which is equivalent to -i != n, is harder to come up with.