You are viewing a single comment's thread. Return to all comments →
Python solution
def repeatedString(s, n): # Write your code here number_of_times_to_multiply = n // len(s) a_count = sum([1 if i == 'a' else 0 for i in s]) res = a_count * number_of_times_to_multiply diff = n - (len(s) * number_of_times_to_multiply) new_s = s[:diff] a_count = sum([1 if i == 'a' else 0 for i in new_s]) res = res + a_count 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 →
Python solution