You are viewing a single comment's thread. Return to all comments →
def repeatedString(s, n): # Write your code here s_len = len(s) multiplier = n // s_len remaning = n % s_len a_count = 0 remaning_a_count = 0 for i, val in enumerate(s): if val == "a": a_count += 1 if i < remaning: remaning_a_count += 1 a_count = a_count * multiplier a_count = a_count + remaning_a_count return a_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 →