Can anyone explain yesterday cook off substring solution

Given a string C u had to find two string A and B suchg that B is substring of A
eg-- S=abcdb
lets take string C as abcdb for given string u had to find 2 string which satisfies above condition for that
Take pen and paper and try different possibilities u will find that
S is composed of
so take A=abcd and B=b and B is substring of A as A[3]=B[0]
so conclusion is always take last character of that string B and check in string A of length n-1 whether B occur if yes that output yes else no

got it thank u

1 Like