Problem Description
Check if pattern p exists in string s.
Solution
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public boolean checkForPattern(String s, String p){
String str = p + "$" + s;
int[] lps = LPS.getLPS(str);
for(int i=0; i<lps.length; i++){
if(lps[i] == p.length()){
return true;
}
}
return false;
}