Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Minimum Window Subsequence
Bookmark
Brute Force
Forward-Backward
Dynamic Programming
Input
Input 1
Input 2
Input 3
No Window
Custom
s1
=
abcdebdde
,
s2
=
bde
two-pointer scan
bestLen =
∞
s2
s1
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
two-pointer scan
bestLen =
∞
s2
s1
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
forward →
bestLen =
∞
s2
s1
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
right
all of s2 collected
, window ends at 4
forward →
bestLen =
5
s2
s1
best = 5
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
i
match
: collected 3/3 of s2, advance j
forward →
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
i
match
: collected 1/3 of s2, advance j
forward →
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
i
no match, advance i only
forward →
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
right
6
≥ best
4
keep best
forward →
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
right
all of s2 collected
, window ends at 8
forward →
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
j
right
all of s2 collected
, window ends at 8
two-pointer scan
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
only 0/3 collected
: no more windows
two-pointer scan
bestLen =
4
s2
s1
best = 4
0
1
2
b
d
e
a
b
c
d
e
b
d
d
e
0
1
2
3
4
5
6
7
8
min window =
4
algo
master
.
io
Step:
Start of algorithm
0 / 69
Input
Input 1
Input 2
Input 3
No Window
Custom
s1
=
abcdebdde
,
s2
=
bde
0 / 69
algo
master
.
io
Step:
Start of algorithm