3 ms·
Ooh if it's a subsequence I am not aware of the solution. For a substring though, you can just concatenate S and its reverse , find the suffix array and corres
by EricDeb 15y ago
Ooh if it's a subsequence I am not aware of the solution. For a substring though, you can just concatenate S and its reverse , find the suffix array and corresponding height array in O(n), and parse through the suffix array looking for suffixes with high height array values where one suffix is from S and the next suffix is from its reverse.
Generally speaking anything you can do with a suffix tree you can do with suffix arrays... though oftentimes it is more complicated
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]