Bestest Solution Ever In JavaScript
\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 = f
\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    let idx2 = 0;\n    \n    let doWhile = true;\n    let strCounter = 0;\n    let sumChars = 0;\n    let iterations = 0;\n    while (doWhile && iterations < n1) {\n        for (let idx1 = 0; idx1 < s1.length; idx1++) {\n            const char1 = s1[idx1];\n            const char2 = s2[idx2];\n            if (char1 === char2) {\n                sumChars++;\n                idx2++;\n                if (sumChars === s2.length) {\n                    strCounter ++;\n                    sumChars = 0;\n                    idx2 = 0;\n                }\n            }\n        }\n        if (sumChars === 0) {\n            doWhile = false;\n        }\n        iterations++;\n    }\n    return Math.floor((strCounter / n2) * (n1 / iterations));\n}\n```
['String', 'Dynamic Programming', 'JavaScript']