You are viewing a single comment's thread. Return to all comments →
Here's a Javascript solution:
function repeatedString(s, n) { const remaining = Math.round((n / s.length - Math.floor(n / s.length)) * s.length); const aInSingle = (s.match(/a/g) || []).length; return Math.floor(n/s.length)*aInSingle + (s.substring(0,remaining).match(/a/g) || []).length }
Seems like cookies are disabled on this browser, please enable them to open this website
Repeated String
You are viewing a single comment's thread. Return to all comments →
Here's a Javascript solution: