Subarray Division 2

  • + 1 comment

    // sliding window method

    def birthday(s, d, m):

    c = 0
    for i in range(len(s)):
        if sum(s[i:i + m]) == d:
            c += 1
    return c