Power of String
Practice
3.8 (18 votes)
Data structures
Hard
String manipulation
Suffix tree
Problem
21% Success 3185 Attempts 50 Points 10s Time Limit 256MB Memory 1024 KB Max Code

For a given integer K and a string S of length N, we denote power of S, as the length of a longest substring occurring in S at least K times.

Given K and S, find the power of S.

Constraints:

1 <= N <= 106
1 <= K <= N
S consists of latin lowercase letters only

Input format:

In the first line there are two integers K and N separated by a single space. The second line constains string S itself.

Output format:

In one line, output the power of string S for a given K.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
No similar problems found