According to definition of prefix on Wikipedia :" A proper prefix of a string is not equal to the string itself."
so how for "test case 1: <<>> " answer 4 is possible ?
plz explain if i am going wrong.
According to definition of prefix on Wikipedia :" A proper prefix of a string is not equal to the string itself."
so how for "test case 1: <<>> " answer 4 is possible ?
plz explain if i am going wrong.
Please ask these type of questions on comments page. . However the question wants you to output “maximum length” of string that is valid starting from index 0.
for example
<<>> here whole string is valid so length is 4
<>>> here only starting 2 is valid so length is 2
Hope that clears your doubt.
PS: The questions talks about prefix not “proper prefix” . A prefix can be equal to the string itself.