The first line of input contains an integer ‘T’ denoting the number of test cases.
The next ‘T’ lines represent the ‘T’ test cases.
The first and only line of the test case contains a single string 'S'.
For each test case, print a single line containing a single integer denoting the length of the longest possible duplicate substrings.
The output of each test case will be printed in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= T <= 50
1 <= length of string <= 200
Time limit: 1 sec.
The key idea is to find all possible substrings and keep the count of all substrings and return the length longest substring which appears more than once.
Algorithm:
The key idea is to find the longest common substring using dynamic programming between the same string such that their ending index are not same.
Algorithm:
The key idea is to check if a duplicate substring of a particular size exists or not.To check if a particular size duplicate substring exists we will use Rabin-Karp algorithm.
Algorithm:
Find minimum
Randomly Sorted
Search In A Sorted 2D Matrix
Maximum GCD
Fake Coin Problem