You are viewing a single comment's thread. Return to all comments →
def repeatedString(s, n): fullCount = n // len(s) leftCount = n % len(s) aCount = sum(1 if char == "a" else 0 for char in s) res = aCount * fullCount for i in range(leftCount): if s[i] == "a": res += 1 return res
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 →
Python3 Solution