You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.Given an input string S write a function which returns true if it satisfies S = nT. Basically you have to find if a given string can be represented from a substring by iterating it �n� times. n >= 2
An example would suffice
Function should return true if
1) S = abab
2) S = abcdabcd
3) S = abcabcabc
4) S = zzxzzxzzx
Function should return false if
1) S = abac
2) S = abcdabbd
3) S = abcabcefg
4) S = zzxzzyzzx
*/
publicclassNTMatch {
publicbooleanmatch(charstr[]){
intkmp[] = buildKMP(str);
intindex = kmp[str.length-1];
//reason end is this rather than index+1 because
//if our string was ababab for KMP we would have index as 4 at str.length-1 and we