Count The Repetitions
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\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)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {string} s1\n * @param {number} n1\n * @param {string} s2\n * @param {number} n2\n * @return {number}\n */\nvar getMaxRepetitions = function(s1, n1, s2, n2) {\n    const len1 = s1.length;\n    const len2 = s2.length; \n    let count1 = 0; // Number of times s2 can be formed from s1\n    let count2 = 0; // Number of times str2 = [s2, count2] can be formed from str1 = [s1, count1]\n    let i = 0; // Pointer for s1\n    let j = 0; // Pointer for s2\n    while (count1 < n1) {\n        if (s1[i] === s2[j]) {\n            j++;\n            if (j === len2) {\n                j = 0;\n                count2++;\n            }\n        }\n        i++;\n        if (i === len1) {\n            i = 0;\n            count1++;\n        }\n    }\n    return Math.floor(count2 / n2);\n};\n```
['JavaScript']