How to Solve this code?Question on the Image click to open
String s contains lowercase alphabets (a-z). we need to erase the string using following methods:
Method 1: Erase the entire string at once
Method 2: Erase the prefix s[1:i] when s[1:i] = s[i+2:2i]. This means substring s[i+1:2i] and prefix s[1:i] are identical.
The given string can be erased in multiple steps and in each steps either of the above mentioned methods above can be used. Compute the maximum number of steps required to erase the entire string.
I need to know how to solve this problem using java
Aucun commentaire:
Enregistrer un commentaire