• + 1 comment
    int c=0;
            for(int i=0;i<n;i++)
            {
                int sum=0,j=i,lp=0;
                 if((j+m)>=n && (j+m)!=1)
                        break;
                else
                {
                   while(lp<m)
                   {
                        sum+=s[j++];
                        lp++;
                        if(sum==d)
                            ++c;     
                    }
                }
            }
            return c;
    

    even this is failing i don't know why when i purchased the testcases i was getting the right output.