Code & Problem Statement @ https://backtobackswe.com/platform/co...
Free 5-Day Mini-Course: https://backtobackswe.com
Try Our Full Platform: https://backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: Given a string S and a string T, find the minimum window in S which will contain all the characters in T (matching or exceeding in frequency) in complexity O(n).
Anytime we have time reduced to linear time and we know that much must be done, that is indicative of using some sort of auxiliary structure to keep track of information for us so time can stay low in complexity.
Complexities
s = length of search string
t = length of "pattern" or "character" string
Time: O( s + t )
At worst we will touch each element twice, once by the left pointer and once by the right pointer.
Ex:
s = "aaaaat"
t = "t"
We will spend t time to build the character requirements hashtable.
Space: O( s + t )
At worst the window hashtable will have a mapping for every character in s.
At worst t will have all unique characters.
s = "abcdef"
t = "abcdef"
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: / @hackerrankofficial
Tuschar Roy: / tusharroy2525
GeeksForGeeks: / @geeksforgeeksvideos
Jarvis Johnson: / vsympathyv
Success In Tech: / @successintech
++++++++++++++++++++++++++++++++++++++++++++++++++
This question is 13.7 in the fantastic book Elements of Programming Interviews
Watch video Minimum Window Substring: Utilizing Two Pointers & Tracking Character Mappings With A Hashtable online without registration, duration hours minute second in high quality. This video was added by user Back To Back SWE 21 February 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 123,755 once and liked it 4 thousand people.