getting WA …help me out guys !! pls !!
question : Z Algorithm Tutorials & Notes | Algorithms | HackerEarth
my code : 1eykjC - Online C++0x Compiler & Debugging Tool - Ideone.com
try this input
abcabc
abcabcabc
answer is 2 but your code is giving 1
1 Like
In the lines #36 and #53, you have written the following statement inside the while loop.
Z[i] = R-L;
According to the algorithm in the link provided, this should be outside the while loop. After this change your code gives correct output for the input given by @hruday968
1 Like
i got 2 on my compiler !!
1 Like
i got 1 on hackerearth compiler
1 Like