Easy sliding window cpp


#1
`

int Solution::solve(vector &A, int B)
{
int count=0, curSum=0;
int i=0, j=0;
for(int j=0; j<A.size(); j++)
{
curSum += A[j];
while(curSum>=B)
curSum -= A[i++];
count += j-i+1;
}
return count;
}
`