C# Brute Force Approach with slight time optimization. Slow but it works.
Intuition\n Describe your first thoughts on how to solve this problem. \nWe cannot actually store (s1 * n1) and (s2 * n2) due to memory constraints. Therefore w
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe cannot actually store (s1 * n1) and (s2 * n2) due to memory constraints. Therefore we need to make n1 loops over s1, and for every n2 matches of s2 that we can find we increment count by 1.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n1 * s1.Length)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\npublic class Solution {\n    public int GetMaxRepetitions(string s1, int n1, string s2, int n2) {\n        int count = 0, ind = 0, loops = 0;\n        for (int i = 0; i < n1; i++){\n            for (int k = 0; k < s1.Length; k++){\n                if (s1[k] == s2[ind]) ind++;\n                if (ind == s2.Length){\n                    ind = 0;\n                    loops++;\n                }\n                if (loops == n2){\n                    loops = 0;\n                    count++;\n                }\n            }\n            if (ind == 0 && loops == 0){\n                int add = count;\n                int times = i + 1;\n                while (i + times < n1){\n                    i += times;\n                    count += add;\n                }\n            }\n        }\n\n        return count;\n    }\n}\n```
['C#']