Hi guys, Am trying to solve this problem http://codeforces.me/problemset/problem/535/D. My algorithm is create a string which fits the given condition. i.e. vector of vector of chars. And use the Z algorithm to compute the longest prefix starting from the indexes given in the statement and check if it is atleast as length as p. But to my suprise i am getting memory limit exceeded on test 3 and i could not figure out what is going on here. Can someone plz tell me. My solution is https://ide.geeksforgeeks.org/9nrDUDjby6. Thanks