Find longest repeating substring in string?
问题 I came across below program which looks perfect. Per me its time complexity is nlogn where n is the length of String. n for storing different strings,nlog for sorting, n for comparison. So time complexity is nlogn. Space complexity is n for storing the storing n substrings My question is can it be further optimized ? public class LRS { // return the longest common prefix of s and t public static String lcp(String s, String t) { int n = Math.min(s.length(), t.length()); for (int i = 0; i < n;