Why This Code is Giving TLE?

This is question :- https://hack.codingblocks.com/app/practice/3/715/problem

This is my code:-

hello @dhruvilcodes

brute force approach will not work.

study about binary indexed tree/fenwick tree to solve this problem

1 Like

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.