Algo.Java.MaxRepeatingSubString

// https://leetcode.com/problems/maximum-repeating-substring/

    public static int maxRepeating(String sequence, String word)
    {
        int a = word.length();
        int count = 0;
        StringBuilder sc = new StringBuilder(word);
        while(sequence.indexOf(sc.toString()) != -1)
        {
            count++;
            sc.append(word);
        }
        return count;
    }
This entry was posted in Без рубрики. Bookmark the permalink.

Leave a Reply

Your email address will not be published.