leetcode686 C++ 20ms 重复叠加字符串匹配 没啥意思


class Solution {
public:
    int repeatedStringMatch(string A, string B) {
        string mA;
        int m=0;
        while(mA.size() <= B.size()){
            mA += A;
            m++;
            if(mA.find(B) < mA.size()){
                return m;
            }
        }
        mA += A;
        m++;
        if(mA.find(B) < mA.size()){
            return m;
        }
        return -1;
    }
};
原文地址:https://www.cnblogs.com/theodoric008/p/9377936.html