@anshumansingh

Hi Anshuman, based on your previous comment , I have submitted a 2 ptr solution (start ptr, end ptr) along with pref sum. However, it is getting TLE along with partially correct answer. Can you suggest an improvement?

int a=0, b=0;

for(int i=0;i<n;i++)

{

if(A[i]>C)

continue;

```
if(a<i)
a=i;
while(a<n && sum_itoj(pref, i, a)<B)
a++;
if(sum_itoj(pref, i, a)>C)
continue;
if(b<a)
b=a;
while(b<n && sum_itoj(pref, i, b)<=C)
b++;
ans+=b-a;
}
```