Required time complexity is less than O(n^2). I did this in n^2 but got only part


#1

Required time complexity is less than O(n^2). I did this in n^2 but got only partial marks because of TLE!!


#2

you might have an infinite loop in your code. there is no time complexity restriction here!


#3

This is not true. Please remove this comment as it is not true, and misleading.
I got to n^2 solution quite fast but reject it because of the comment.
Then spent some time trying to come up with better than n^2 solution, and failed.
So I implemented n^2 solution and it passes perfectly fine.


#4

It’s not misleading. A n^2 solution that uses more memory or iterate more times than the response will not be accepted.


#5

Just a heads-up for those who curious. Python O(n ^ 2) time, O(n) space solution is accepted. Good luck :slight_smile:


#6

When u find your target value in the map then not just update your result vector update your hash table too.That may help your solution with O(n^2) to get accepted.