Test Cases Showing TLE

My code is showing TLE , in the given problem even though I have used the concept of prefix sum array to count the sum of sub array.
Please help me to solve the problem.
Thank You.

hello @paulayush2002

ur current solution has time complexity O(n^2) ,that is why it is showing tle.

try to solve it in O(n)

pls refer this->
https://www.youtube.com/watch?v=p5Cm_r4T1Rw

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.