We define the score of a string as the length of longest substring of which appears more than one times in . (The substrings may overlap)
Let be the sum of the scores of all the strings in this file . Find
Click here to open the file.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The solution below runs O ( n 2 ) on the average case. I wonder if it is possible to prove the existence of an algorithm that runs at atleast O ( n l o g ( n ) ) .