You are viewing a single comment's thread. Return to all comments →
The return value got me confused, but your explanation was very helpful! Thanks!
function repeatedString(s, n) {
let count = (s.match(/a/g) || []).length * Math.floor(n/s.length) let remainder = n % s.length let remainderCount = (s.substring(0, remainder).match(/a/g) || []).length return count + remainderCount
}
This was what I used!
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 →
The return value got me confused, but your explanation was very helpful! Thanks!
function repeatedString(s, n) {
}
This was what I used!