How many substrings?

how find the number of diffrent substrings in string S.

If this question is related to the problem included in Sep 13 challenge, then please hold on till the contest gets over. You will be answered in a very better manner. Don’t worry. :slight_smile:


if the string length is n… then total substrings are 2^n .

And how come, the tile of this question is “permutation and combination”?

build the suffix array and compute the lcp(longest common prefix).

for clarity: if S=aa than it’s got 3 different substrings - empty, ‘a’ and ‘aa’?

he has asked for different substrings

updated :smiley:

1 Like