Longest repeating substring length

Write codeHard35 minGoogle style

Your task

Given a string s, find the length of the longest substring that occurs at least twice in s (occurrences may overlap). Return 0 if no character repeats. 1 <= len(s) <= 30000, lowercase letters. Aim for better than O(n^2) substring enumeration.

Examples

longest_repeated_substring_len(s: str) -> int
Example 1
Inputlongest_repeated_substring_len("banana")
Output3