You are viewing a single comment's thread. Return to all comments →
Using JS
function repeatedString(s, n) { if(s.length == 1){ return n; }else{ let count = 0; while(s.length < n){ s = s + s; } let newString = s.substr(0, n); for (let partString of newString) { if (partString === 'a') { count++; } } return count; } }
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 →
Using JS