• + 0 comments

    Python solution

    def repeatedString(s, n):
        a_count = 0
        for c in s:
            if c=="a":
                a_count+=1
        
        repeated = a_count*(n//len(s))
        mod = n%len(s)
        for c in s[:mod]:
            if c=="a":
                repeated+=1
        return repeated