O(nlgn) time is accepted for this problem?
It should not be. We were looking for O(n) solution. This just indicates that our test data is weak. Will work on correcting it.
Anshuman Singh Hey, The o(nlogn) solution still works. I solved it with O(nlogn).
Anshuman Singh I submitted an O(nlgn) solution and it was accepted.
I assume you did a binary search. This gives O(nlogn) time complexity. But the question states less than O(n) space complexity. It is satisfied right. O(1). Why do we need to do it O(n) time complexity then ? I seem to not understand this.
I’ve solved this with O(nlogn) using binary search. Please improve tests, or at least add O(n) time constraint to problem statement.