程式語言 - LeetCode - C++ - 459. Repeated Substring Pattern



參考資訊:
https://www.cnblogs.com/grandyang/p/6087347.html

題目:


解答:

class Solution {
public:
    bool repeatedSubstringPattern(string s) {
        string d = s + s;
        string t = d.substr(1, d.size() - 2);

        return t.find(s) != string::npos;
    }
};