• + 0 comments

    JS solution :

    function repeatedString(s, n) {
        return ([...s.matchAll(/a/g)].length * Math.floor(n / s.length)) + ([...s.substring(0, (n % s.length)).matchAll(/a/g)].length);
    }