Minimum Window Substring
In this class, We discuss Minimum Window Substring.
Readers can prepare an entire competitive coding course to crack product development companies. Click Here.
The reader should have basic coding skills to work with competitive coding. Click here.
Question:
Given two strings S and P.
Find the smallest window in string S which consists of all the characters in P.
Return an empty string or -1 if no such window exists.
Suppose multiple windows with the same length exists. Return window with minimum start index.
Example:
S = “zoomlazapzo”
P = “oza”
Output: “apzo”
Logic:
We use an array to store the count of each character.
The step-by-step explanation is provided in the video.
Code: