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:
So how to solve this question efficiently w/o Sliding Window technique?