absolutely horrendous C++ solution (2725 ms, 6.78 MB)
Intuition\n Describe your first thoughts on how to solve this problem. \nit\'s just brute-force\n\n# Approach\n Describe your approach to solving the problem. \
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nit\'s just brute-force\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\ni couldn\'t be bothered coding up the solution where you find a pattern so i just erased characters from s1 that doesn\'t exist in s2 and somehow it\'s just about quick enough to pass\n\n# Complexity\n- Time complexity: $O(str1.size())$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $O(1)$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int getMaxRepetitions(string s1, int n1, string s2, int n2) {\n        vector<bool> ins2(26, false);\n        for (char & c : s2) {\n            ins2[c - \'a\'] = true;\n        }\n        for (int i = 0; i < s1.size(); i++) {\n            if (!ins2[s1[i] - \'a\']) {\n                s1.erase(s1.begin() + i);\n                i--;\n            }\n        }\n        int r2 = 1, i2 = 0;\n        int ans = 0;\n        for (int i1 = 0, r1 = 1; i1 < s1.size() || r1 < n1; i1++) {\n            if (i1 == s1.size()) {\n                i1 = -1;\n                r1++;\n                continue;\n            }\n            if (s2[i2] == s1[i1] && ++i2 == s2.size()) {\n                if (r2 == n2) {\n                    ans++;\n                    r2 = 0;\n                }\n                i2 = 0;\n                r2++;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']