You are viewing a single comment's thread. Return to all comments →
Here is my c++ solution, you can watch the explanation here : https://youtu.be/Vh5davsSkfA
long ccount(string s) { return count(s.begin(), s.end(), 'a'); } long repeatedString(string s, long n) { return (n / s.size()) * ccount(s) + ccount(s.substr(0, n % s.size())); }
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 is my c++ solution, you can watch the explanation here : https://youtu.be/Vh5davsSkfA