Runtime Error in TASHIFT

I am using Z-Algorithm on the TASHIFT but it is giving me SIGSEGV on Last 2 Cases. Please Help
http://www.codechef.com/viewsolution/4692695

int Z[n]; will give RE when n becomes 1000000 .

Instead use this:
int *Z=(int *)malloc(sizeof(int)*n);

This will give you AC I think. :slight_smile:

2 Likes

Thanks, It works :slight_smile:

//