Wildcard Multi-Delimiter Validation
Updated
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*.
More Tennr Phone Screen questions
Similar questions at other companies
- Longest Palindromic SubstringSiemens · PHONE SCREEN
- Query Words Within K PositionsPalantir · PHONE SCREENPalantir interview questions
- Edit DistanceDP World · PHONE SCREEN
- Longest Palindromic SubstringIBM · PHONE SCREENIBM interview questions
- Word BreakAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Decode WaysThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
- Edit DistanceAstrotalk · PHONE SCREEN
- Longest Palindromic SubstringeBay · PHONE SCREENeBay interview questions
- Validate a Palindrome After Limited DeletionsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
- Count Palindromic SubstringsThe Voleon Group · PHONE SCREEN