Yeah, don't write the program for him. The minute he goes into a test and they give him a similar problem (yet not so similar) he won't be able to solve it, because he doesn't have the skills.
As for the problem, I could probably whip it up in Java, but I still don't understand the concept.
I guess the best advice to give is to notice that array indexes are always n-1. So make a counter with respect to that. And I see Slo's pointed that out, too.