Valid Parenthesis String
A star in s may represent an opening parenthesis, a closing parenthesis or an empty string. Return whether some choices make the complete string balanced.
Example 1
s = "(*))"trueExplanation
Use the star as an opener to obtain (()).
Example 2
s = ")*("falseExplanation
The initial closer has nothing before it to balance it.
Example 3
s = "***"trueExplanation
Use all stars as empty strings to obtain a balanced sequence.
Constraints
- 1 <= len(s) <= 100
- Characters are (, ), *
Function contract
checkValidStringArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 35 cases, on your device.
"(*))"