Help in this problem

It will take O(N*LogN) time leading to an easy TLE as N<=10^8

It would run for every element of array. So, O(M*N*logN)

No , actually O(M*N) Would be more correct

1 Like