Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Stream of Characters
Bookmark
Brute Force
Reversed Trie
Input
Example 1
Example 2
Example 3
Custom
words
=
[cd, f, kl]
,
queries
=
[a, b, c, d, e, f, g, h, i, j, k, l]
Query
-
Suffix
-
Result
-
wordSet
cd
f
kl
Query
-
Suffix
-
Result
-
wordSet
cd
f
kl
Query
query('b')
Suffix
"b"
Result
?
wordSet
cd
f
kl
stream
a
0
b
1
Query
query('c')
Suffix
"bc"
Result
?
wordSet
cd
f
kl
stream
a
0
b
1
c
2
Query
query('e')
Suffix
-
Result
?
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
Query
query('f')
Suffix
"f"
Result
true
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
f
5
Query
query('g')
Suffix
-
Result
false
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
f
5
g
6
Query
query('i')
Suffix
-
Result
?
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
f
5
g
6
h
7
i
8
Query
query('j')
Suffix
"j"
Result
?
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
f
5
g
6
h
7
i
8
j
9
Query
query('k')
Suffix
"jk"
Result
?
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
f
5
g
6
h
7
i
8
j
9
k
10
Query
-
Suffix
-
Result
-
wordSet
cd
f
kl
stream
a
0
b
1
c
2
d
3
e
4
f
5
g
6
h
7
i
8
j
9
k
10
l
11
algo
master
.
io
Step:
Store 3 words in a set, longest is 2 characters
0 / 44
Input
Example 1
Example 2
Example 3
Custom
words
=
[cd, f, kl]
,
queries
=
[a, b, c, d, e, f, g, h, i, j, k, l]
0 / 44
algo
master
.
io
Step:
Store 3 words in a set, longest is 2 characters