only two test cases pass.
plz help me to fix my code.
String window only some test case fail
check if your are doing the something related to this…
First check if length of string is less than the length of given pattern, if yes then "no such window can exist ".
Store the occurrence of characters of given pattern in a hash_pat[].
Start matching the characters of pattern with the characters of string i.e. increment count if a character matches
Check if (count == length of pattern ) this means a window is found
If such window found, try to minimize it by removing extra characters from beginning of current window.
Update min_length
Print the minimum length window.
i had generated all substring with length greater than size of set of second string and
as soon i found a string that contain all character of set then
i print it , because that is the smallest string.
plz see my code and and help me to fix the code.
you can’t do that beacuse it will take n^2 time… and n <= 100000
think any optimized solution in O(n)
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.
i’m unable to think an algorithm that run in o(n) time complexity.
help me plz
First check if length of string is less than the length of given pattern, if yes then "no such window can exist ".
Store the occurrence of characters of given pattern in a hash_pat[].
Start matching the characters of pattern with the characters of string i.e. increment count if a character matches
Check if (count == length of pattern ) this means a window is found
If such window found, try to minimize it by removing extra characters from beginning of current window.
Update min_length
Print the minimum length window