class Solution {
public:
int strStr(char *haystack, char *needle) {
int n = strlen(needle);
if(n==0) {
return 0;
}
int* next = new int[n];
int i=-1;
int j=0;
next[0] = -1; // if mismatch at needle[0], then make current array index align with needle[-1]
while(j