• + 0 comments
    def birthday(s, d, m):
        if len(s) < m:
            return 0
        
        ways = 0
        
        for i in range(len(s) - m + 1):
            if sum(s[i:i + m]) == d:
                ways += 1
        
        return ways