Can anyone tell me what algo should i be following for O(nlogn) complexity? I am


#1

Can anyone tell me what algo should i be following for O(nlogn) complexity? I am getting tle in O(N^2).


#2

Satyaki Chakraborty It is’t working. I got TLE using this method.


#3

u can break loop in O(n^2) for sum>C, this reduces time and even O(n^2) can get accepted mine did.


#4

You can make a cumulative sum array and apply binary search on that.


#5

There exists a O(n) time solution.