Lightweight solution for Java Array is not correct


The expected output for the test case “ababa” is 1 as “ba” is a repeated sequence of length 2 but on running the same test case on the the Lightweight solution provided in Java Array gives output as 0. Therefore, the provided solution approach is wrong.