How many substrings?

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. :slight_smile:

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 :smiley:

1 Like

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