Zero sum subarray problem

My code is passing the given test cases but getting TLE in submission. Can u help me improve its time complexity

ques->https://practice.geeksforgeeks.org/problems/zero-sum-subarrays1825/1

ide->https://ide.codingblocks.com/s/296457

@mikkyimran see the editorial or discuss in bottom many people discusses about it you will probably find the app and logic there. if still not solved comment here

@mikkyimran it would have been better for you if you realised the mistake on your own but no issue i will tell you, use unordered_map instead of map as map takes logn time

1 Like

thanks . so i should always prefer unordered map right instead of maps?

@mikkyimran yes …

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.