Easy C++ solution. Can anyone tell the Time Complexity?


#1

int Solution::numRange(vector &A, int B, int C)
{
int local=0;
int count = 0;
int j=0;
for(int i=0;i<A.size();i++)
{
j=i;
while(local<=C && j<A.size())
{
local = local + A[j];
if(local>=B && local<=C) count++;
j++;
}
local = 0;
}
return count;
}


#2

time taken is n(n-1)/2;