Ques link :

https://practice.geeksforgeeks.org/problems/subarray-with-given-sum/0

I want to solve this question by **STL** only and mainly by unordered_map.

According to me solution is in O(N) only.

But I am getting TLE. I think find() function’s time complexity going from O(1) to worst case!!?

Here is my attempt:

https://ide.geeksforgeeks.org/m1QLsFBjnd

**So how to solve this question efficiently w/o Sliding Window technique?**