Required time complexity is less than O(n^2). I did this in n^2 but got only partial marks because of TLE!!
you might have an infinite loop in your code. there is no time complexity restriction here!
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.
It’s not misleading. A n^2 solution that uses more memory or iterate more times than the response will not be accepted.
Just a heads-up for those who curious. Python O(n ^ 2) time, O(n) space solution is accepted. Good luck
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.