Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Backspace String Compare
Bookmark
Stack
Write Pointer
Two Pointers
Input
Example 1
Example 2
Example 3
Custom
s
=
ab#c
,
t
=
ad#c
s
a
b
#
c
s'
empty
t'
empty
t
a
d
#
c
s
a
b
#
c
s'
empty
t'
empty
t
a
d
#
c
s
a
b
#
c
s'
empty
t'
empty
t
a
d
#
c
s
a
b
#
c
s'
a
b
t'
empty
t
a
d
#
c
i
s[1] =
'b'
→ keep it
s
a
b
#
c
s'
a
b
t'
empty
t
a
d
#
c
i
s[2] =
'#'
→ backspace erases
'b'
s
a
b
#
c
s'
a
c
t'
empty
t
a
d
#
c
i
s[3] =
'c'
→ keep it
s
a
b
#
c
s'
a
c
t'
a
d
t
a
d
#
c
j
t[1] =
'd'
→ keep it
s
a
b
#
c
s'
a
c
t'
a
d
t
a
d
#
c
j
t[2] =
'#'
→ backspace erases
'd'
s
a
b
#
c
s'
a
c
t'
a
c
t
a
d
#
c
j
t[3] =
'c'
→ keep it
s
a
b
#
c
s'
a
c
==
t'
a
c
t
a
d
#
c
'c'
==
'c'
s
a
b
#
c
s'
a
c
t'
a
c
t
a
d
#
c
both reduce to "ac"
return true
algo
master
.
io
Step:
Reduce "ab#c" and "ad#c" with backspaces, then compare
0 / 12
Input
Example 1
Example 2
Example 3
Custom
s
=
ab#c
,
t
=
ad#c
0 / 12
algo
master
.
io
Step:
Reduce "ab#c" and "ad#c" with backspaces, then compare