Practice Valid Parenthesis String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Determine whether s can form a balanced parentheses string. It contains only (, ) and *. Each * may independently stand for one opening parenthesis, one closing parenthesis or an empty string. Every closing parenthesis must match an earlier opening parenthesis, and no unmatched parenthesis may remain. Return whether some choices for the stars satisfy these rules.
Source: Valid Parenthesis String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "()"
true
# Example 2
s = "(*)"
true
# Example 3
s = "(*))"
true
Constraints
Related LeetCode Problems
Practice more problems similar to Valid Parenthesis String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.