5

I know how to find the number of distinct substrings for a string (using suffix arrays) and I was wondering if there was a way to find this number for all of its prefixes.

I already have an $O(N^2)$ solution: computing the suffix array and lcp array for every prefix, but I would like a faster one.

David Richerby
  • 82,470
  • 26
  • 145
  • 239

0 Answers0