Here is the code to get next array in kmp algorithm, please tell me how len = lps[len - 1]works. It is really hard to understand.
len = lps[len - 1]
Consider the e