Description
Given strings s1 and s2, find the minimum contiguous substring W of s1 such that s2 is a subsequence of W. Return empty string if not found.
Examples
Input:
s1 = "abcdebdde", s2 = "bde"Output:
"bcde"Explanation:
Shortest window containing 'bde' as subsequence.
Input:
s1 = "a", s2 = "a"Output:
"a"Explanation:
Edge case with a single character.
Input:
s1 = "jmeqksfrsdcmsiwvaovfkm", s2 = "sv"Output:
"siwv"Explanation:
The minimum window is "siwv" because it contains s -> v in order and no shorter window does.
Constraints
- •
1 ≤ s1.length ≤ 2 * 10⁴ - •
1 ≤ s2.length ≤ 100