Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Valid Parentheses
Bookmark
Input
Nested
Pairs
Mismatch
Extra Closing
Unclosed
Custom
s
=
([{}])
0
1
2
3
4
5
(
[
{
}
]
)
stack
0
1
2
3
4
5
(
[
{
}
]
)
stack
0
1
2
3
4
5
(
[
{
}
]
)
i
stack
s[0] =
'('
opening bracket
0
1
2
3
4
5
(
[
{
}
]
)
i
(
top
stack
push
'('
onto the stack
0
1
2
3
4
5
(
[
{
}
]
)
i
(
[
top
stack
push
'['
onto the stack
0
1
2
3
4
5
(
[
{
}
]
)
i
(
[
top
stack
s[2] =
'{'
opening bracket
0
1
2
3
4
5
(
[
{
}
]
)
i
(
[
{
top
stack
s[3] =
'}'
closing, needs
'{'
on top
0
1
2
3
4
5
(
[
{
}
]
)
i
(
[
{
top
stack
top
'{'
matches
'}'
, pop it
0
1
2
3
4
5
(
[
{
}
]
)
i
(
[
top
stack
top
'['
matches
']'
, pop it
0
1
2
3
4
5
(
[
{
}
]
)
i
(
top
stack
s[5] =
')'
closing, needs
'('
on top
0
1
2
3
4
5
(
[
{
}
]
)
stack
return true
, all brackets matched
algo
master
.
io
Step:
Start of algorithm
0 / 14
Input
Nested
Pairs
Mismatch
Extra Closing
Unclosed
Custom
s
=
([{}])
0 / 14
algo
master
.
io
Step:
Start of algorithm