Suppose I have string str = "aabaa"
Its non repetitive substrings are
- a
- b
- aa
- ab
- ba
- aab
- aba
- baa
- aaba
- abaa
- aabaa
Suppose I have string str = "aabaa"
Its non repetitive substrings are
Compute the suffix array and the longest common prefix array thereof.
a
1
aa
2
aabaa
1
abaa
0
baa
Return (n+1)n/2
, the number of substring bounds, minus the sum of the longest common prefix array.
(5+1)5/2 - (1+2+1+0) = 15 - 4 = 11.