459
class Solution {
public:
bool repeatedSubstringPattern(string s) {
string t = s + s;
t.erase(t.begin());
t.erase(t.end() - 1);
if ( t.find(s) != string::npos) return true;
return false;
}
};
总结:
看懂了,但是还是有点迷糊,暂时采用向右移动一位的方式理解next数组,下一轮再消化其他两种方式.