Wildcard Multi-Delimiter Validation
Problem statement
Given a string s containing (, ), <, >, |, and *, return whether it can form a valid, properly nested delimiter string.
The matching pairs are (), <>, and ||. Each * may independently be (, ), or the empty string. A single | can serve as the opening or closing bar according to its matching partner.
Function
isValidDelimiters(s: String) → booleanExamples
Example 1
s = "<(*)>"return = trueUse the wildcard as the empty string; the remaining delimiters are nested.
Example 2
s = "<|*)|>"return = trueUse the wildcard as an opening parenthesis, producing <|()|>.
Example 3
s = "<(|>)"return = falseThe delimiters cross instead of nesting.
Constraints
0 <= s.length <= 80.scontains only(,),<,>,|, and*.