You are viewing a single comment's thread. Return to all comments →
I got the same problem, just make sure you add parenthesis for n//lens, this is the version that works for me:
def repeatedString(s, n): return s.count('a') *( n//(len(s))) + s[:(n%(len(s)))].count('a')
def repeatedString(s, n):
return s.count('a') *( n//(len(s))) + s[:(n%(len(s)))].count('a')
Meanwhile, this is the version that fails for 12/23 cases:
def repeatedString(s, n): return s.count('a') * n//(len(s)) + s[:(n%(len(s)))].count('a')
return s.count('a') * n//(len(s)) + s[:(n%(len(s)))].count('a')
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 →
I got the same problem, just make sure you add parenthesis for n//lens, this is the version that works for me:
Meanwhile, this is the version that fails for 12/23 cases: