Prefix array doubt

“A string x is a prefix of another string y if there is a string v such that y = xv. v is called a suffix of y.”

And, we have concluded that a string can be a prefix of itself. (Not proper prefix but prefix, yeah…)

But according to the definition, if a string is prefix of itself then v should be a empty string. And, v is also a suffix of y. So again question arises is like, then can empty string be a suffix of a string!!

And, according to this, suffix can’t be a empty string.

So bhaiya, which one is a fact…

@Kinjal

yeah suffix cant be empty.
but why are u mixing prefix and suffix together.
prefix contains all proper prefix and the string itself thats it, dont involve suffix in it.

Because of this definition below…

Here, if x=y then v is empty string, right!!!
And, v is also a suffix of y.

ignore bro , tumko hamesha clear kar denge problems mein ki prefix mein kya include karna hai aur kaya nahi.

1 Like