• + 10 comments
    def solve(n, s, d, m):
        # Complete this function
        count = 0
        for i in range(0,n):
            total = sum(s[i:m+i])
            if total == d:
                count+=1
        return count
    

    This function uses a sliding window too :) If any corrections please comment :)