CodeMentor.
Ask AIProblemsLearnC++TCSCore CSHRProgress
0Lv 1
ProblemsStack & Monotonic Stack

Valid Parentheses

Easy
LeetCode
1/3
EasyStack & Monotonic StackLeetCode #20

Valid Parentheses

Stack of opens. On close, top must match. Empty at end.

Examples

Example 1

Input

()

Output

true
Example 2

Input

()[]{}

Output

true

Stuck? Take a nudge

C++17Autosaves