Configurable Valid Parentheses
Updated
Problem statement
Given a string text and a list pairs, return true if the delimiters in text are correctly nested and all closed, otherwise false.
Each two-character string in pairs gives an opening character and its matching closing character. Characters of text that appear in no pair are ignored.
Every closing character must match the most recent opening character that is still open, and nothing may be left open at the end.
Function
validConfiguredParentheses(text: String, pairs: String[]) → booleanExamples
Example 1
text = "x<aAb>y"pairs = ["<>","aA","bB"]return = falsex and y are ignored, and A closes a. Then b opens, so the closing angle bracket arrives while B is expected, and the answer is false.
Constraints
- Every pair has length two.
- No character appears more than once across all pairs.
text.length <= 10^6.
More Bloomberg LP Phone Screen questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREENRoblox interview questions
- Configurable Valid BracketsMaven Clinic · PHONE SCREEN · ONSITE INTERVIEWMaven Clinic interview questions
- Simplify a Formula with Known and Unknown VariablesBetter.com · PHONE SCREEN
- Number Words to Digits in Any LanguageMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Number of AtomsAmazon · ONSITE INTERVIEW
- Group Timestamps into Consecutive-Day IntervalsDuolingo · PHONE SCREENDuolingo interview questions
- Adjacent Pair and Run RemovalWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
- Business Account KYC Verification — Parts 1–5Stripe · PHONE SCREENStripe interview questions
- In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
- Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)