You are viewing a single comment's thread. Return to all comments →
Ruby solution:
def repeatedString(s, n) indexes = [] (0..s.length-1).each do |index| indexes << index if s[index] == 'a' end return 0 if indexes.empty? count = 0 size = s.size indexes.each do |index| count += ((n - 1 - index) / size) + 1 end count end
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 →
Ruby solution: