You are viewing a single comment's thread. Return to all comments →
def repeatedString(s, n):
count=0 count=count_a(s) if(n%len(s)==0): count=count*(n//len(s)) elif(n%len(s)!=0): count=count*(n//len(s))+count_a(s[0:(n%len(s))]) return count
def count_a(s): count=0 for i in s: if (i=="a"): count+=1 return count
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Repeated String
You are viewing a single comment's thread. Return to all comments →
def repeatedString(s, n):
def count_a(s): count=0 for i in s: if (i=="a"): count+=1 return count