I am pretty new to code chef, and had tried my first program over here.
I just tried out this question:
hmm… as per the the explanation of the question, its quite unclear, as i have no idea about LCP and Suffix array. I just tried a simple approach and used dynamic arrays to prevent space wastage.
However, i got my time limit exceeded.
here’s my program:
basically, i am scanning a string, and then breaking it in sub-strings and passing into a dynamically created 2D array.
I believe its when the sub-strings are compared and looked for duplicate, its taking lots of time.
Could anyone suggest me a better method to ignore duplicate sub-strings?