Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Remove All Adjacent Duplicates In String
Bookmark
Input
Example 1
Example 2
All duplicates
No duplicates
Custom
s
=
abbaca
0
1
2
3
4
5
a
b
b
a
c
a
stack
0
1
2
3
4
5
a
b
b
a
c
a
stack
0
1
2
3
4
5
a
b
b
a
c
a
i
stack
s[0] =
'a'
stack is empty
0
1
2
3
4
5
a
b
b
a
c
a
i
a
top
stack
push
'a'
onto the stack
0
1
2
3
4
5
a
b
b
a
c
a
i
a
b
top
stack
push
'b'
onto the stack
0
1
2
3
4
5
a
b
b
a
c
a
i
a
b
top
stack
'b'
== top
'b'
, remove both
0
1
2
3
4
5
a
b
b
a
c
a
i
a
top
stack
s[3] =
'a'
top =
'a'
0
1
2
3
4
5
a
b
b
a
c
a
i
stack
s[4] =
'c'
stack is empty
0
1
2
3
4
5
a
b
b
a
c
a
i
c
top
stack
s[5] =
'a'
top =
'c'
0
1
2
3
4
5
a
b
b
a
c
a
i
c
a
top
stack
push
'a'
onto the stack
0
1
2
3
4
5
a
b
b
a
c
a
c
a
top
stack
return
"ca"
algo
master
.
io
Step:
Start of algorithm
0 / 15
Input
Example 1
Example 2
All duplicates
No duplicates
Custom
s
=
abbaca
0 / 15
algo
master
.
io
Step:
Start of algorithm