please check.
Time limit exceeded in two test cases
Hi @Aparna although the average time complexity of find in unordered map is constant, it can be linear in the worst case. so you might be taking o(n) time in each query. You can try sorting the array and using binary search, that way it will take o(logn) time even in the worst case.
its the same with ordered_map also? the challenge is to solve using hashing only even in the hint video also they have used the same method. so in hashing there is no other way to to do this?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.