Longest repeating and non-overlapping substring

https://practice.geeksforgeeks.org/problems/longest-repeating-and-non-overlapping-substring/0

i am unable to find a solution to this problem plz explain along with code…

plz reply at the earliest …plz reply
its an imp doubt …

why is no ta replying ??cant anyone solve it??

@S19LPPP0202 hey bro sorry for late reply here is logic:
This can be solved using dp:
The basic idea is to find the longest repeating suffix for all prefixes in the string str.

Length of longest non-repeating substring can be recursively
defined as below.

LCSRe(i, j) stores length of the matching and
non-overlapping substrings ending
with i’th and j’th characters.

If str[i-1] == str[j-1] && (j-i) > LCSRe(i-1, j-1)
LCSRe(i, j) = LCSRe(i-1, j-1) + 1,
Else
LCSRe(i, j) = 0

Where i varies from 1 to n and
j varies from i+1 to n

how do u come up with such solutions how did u proceed??

@S19LPPP0202 hey basically in these problems firstly think in terms of recurson and form recurrence relation as ostly these questions are of same type and logic and after that try thinking of recursion.Alsio through practice you can be perfect.

have u done this question before??
i am still a 2 star codechef how to improve that ??
how to start dev ??what to take bw web app and ml??

@S19LPPP0202 hn bro mene dekha hua tha ye qstn.Bro contest kia kro long or lunchtime and for development start with any technology whether ml or any webd technology,as future scope is for ml so try for ml ,also made one project related to webd also.

where to learn dev from??

(j-i) > LCSRe(i-1, j-1)
why was this condition introduced ??
expalin with help of example plz…

Plz reply to this at the earliest…this is a conceptual doubt…
Why has this condition included??why aren’t you replying??

plz reply…

@S19LPPP0202 hey we have to find maximum length as i is starting point and j is ending point so length of that array part will be j-i and LCSRe(i-1, j-1) will give LCSRe for i-1 and j-1 and we will compare both as we have to get the longest one.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.