You are viewing a single comment's thread. Return to all comments →
Well, after all this problem is in the Algorithms section. Finding out a way to reduce time complexity is all about skillfulness in algorithmic programming.
Mind you, if it really were only mathematical trickery such as knowing some obscure theorem in number theory, then I would agree with you. But this rather is algorithmic trickery which is to be expected with algorithmic exercises.