I just learned Z-algorithm (string processing) and in every problem I solve on it when I start the main outer loop of the function from the index 0 I get TLE but when I start from 1 I get Accepted
for example problem 127D - Password
(here I use the algorithm for matching the string with it self to find out max length of sub string that start at any index i and match a prefix of the whole string)
this submission start the loop from 0 and get TLE 54993356 but this submission start from 1 and get Accepted 54993706
and this is the only change that I made for the Accepted solution ( for(int i=1; i<n; i++) // i start form 1 instead of 0 ************************** ) you can see this in the second submission
so some one could give me a reason and tell my why this happen ? thanks in advance