Subarray Division 1

  • + 0 comments
    def birthday(s, d, m):
        # Write your code here
        ways=0
        end=m
        begin=0
        
        while end<=len(s):
            summ=0
            for i in range(begin,end):
                summ+=s[i]
            if summ==d:
                ways+=1
            end+=1
            begin+=1
        return ways