how find the number of diffrent substrings in string S.

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

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.

2 Likes

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

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

he has asked for different substrings

updated

1 Like

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