forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_1062.java
39 lines (38 loc) · 1010 Bytes
/
_1062.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.fishercoder.solutions;
/**
* 1062. Longest Repeating Substring
*
* Given a string S, find out the length of the longest repeating substring(s). Return 0 if no repeating substring exists.
*
* Example 1:
* Input: "abcd"
* Output: 0
* Explanation: There is no repeating substring.
*
* Example 2:
* Input: "abbaba"
* Output: 2
* Explanation: The longest repeating substrings are "ab" and "ba", each of which occurs twice.
*
* Example 3:
* Input: "aabcaabdaab"
* Output: 3
* Explanation: The longest repeating substring is "aab", which occurs 3 times.
*
* Example 4:
* Input: "aaaaa"
* Output: 4
* Explanation: The longest repeating substring is "aaaa", which occurs twice.
*
* Note:
* The string S consists of only lowercase English letters from 'a' - 'z'.
* 1 <= S.length <= 1500
* */
public class _1062 {
public static class Solution1 {
public int longestRepeatingSubstring(String S) {
//TODO: implement it
return 0;
}
}
}