You are viewing a single comment's thread. Return to all comments →
In C#
public static long repeatedString(string s, long n) { long aNum = s.Count(a => a == 'a'); long repeats = n / s.Length; int leftOver = (int)(n % s.Length); aNum = aNum * repeats; aNum += s[..leftOver].Count(a => a == 'a'); return aNum; }
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 →
In C#