thus considering all of its prefixes). So I already had a solution which, after having the suffix array, could solve the problem in O(N * log(N)) time.