C++ Solution O(n^2) Very simple


#1

int count=0, sum=0;
int n=A.size();
for(int i=0;i<n;i++)
{
sum=0;
for(int j=i;j<n;j++)
{
sum+=A[j];
if(B<=sum && sum<=C)
{
count++;
}
else if(sum>C)
{
break;
}
}
}
return count;