directory
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Sep 24, 2026
License: BSD-3-Clause
Opens a new window with license information.
README
¶
Name
34 - validate parenthesis expression
Description
Problem
Validate a string of a parenthesis expression. Valid parenthesis pairs are "()", "[]", and "{}".
Example
Expression "([])" is valid but "{[]" is invalid because "{" is unbalanced.
Solution
Details
Use stack to keep track of opening parenthesis and validate last item on the
stack when facing a closing parenthesis.
Complexity:
Directories
¶
Click to show internal directories.
Click to hide internal directories.