Im having problem in this code can u help me what is wrong in this code

Hi Anshu
I can see a couple of mistakes
In line 37 :: if(mp[s[slow]] == 0) , if t++ happens, you shall immediately get out of the loop without incrementing slow. Use a break there.
Also for marking the key value pairs in the map initially, prefer to use something other than 0. 0 is the default value given to any key value pair as soon as m[any_index] is called. So when you try to check m[i]==0 ? Then even if it wasn’t 0 , it would now become 0. I hope you have understood this point.

sir whenever t++ happens while(t == 0) conditon fails and it automatically gets out of the loop…slow++ is necesaay . if i dont increase slow++ , (fast - slow) will always be less than (arr[1] - arr[0]) and the coditon will never be true because during every iteration of for loop fast is increasing

bhai how much time u need

I apologize for the delay in response.
How do we approach this problem?
1.First check if the length of string is less than the length of the given pattern, if yes then “no such window can exist “.
2.Store the occurrence of characters of the given pattern in a hash_pat[].
3.Start matching the characters of pattern with the characters of string i.e. increment count if a character matches.
4.Check if (count == length of pattern ) this means a window is found.
5.If such window found, try to minimize it by removing extra characters from the beginning of the current window.
6.Update min_length.
7.Print the minimum length window.

While doing step 5, you are first removing s[slow] and then saying that lets find it again in the remaining string. Rather we shall first find it in the remaining string and then remove s[slow]. So we shall immediately move out of the while loop as soon as we encounter t++.
Also, implement the second point in your code i mentioned earlier and share your code again if you find any difficult. I apologize again for a delayed response.

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.