in kmp preprocess function j should hav been initialized to -1 as explained by sir in the tutorial but in the code y sir has initialized j to 1
Kmp string match algo
j should always be initialised to -1. I think for that particular question it doen’t cause any error but it will also work if you initialise it to -1 instead of 1. Thanks.