Configurable Valid Brackets
Reported by candidates from Maven Clinic's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The edge case that kills the naive solution in Maven Clinic's Configurable Valid Brackets is the one you'd never hardcode: delimiters that aren't brackets at all. Reported in August 2025, this OA hands you pairs like "<>", "aA", "bB" and asks if the text nests correctly. Letters can be delimiters, and every other character is noise to skip. It's a stack problem wearing a costume. If you blank on the setup, StealthCoder runs invisibly during the live OA and gives you a working solution, but you should know the shape before you start.
The problem
Each two-character string in pairs gives an opening and its matching closing character. Ignore text characters absent from all pairs. Return true when configured delimiters are correctly nested and completely closed. Function validConfiguredParentheses(text: String, pairs: String[]) → boolean Examples Example 1 text = "x<aAb>y" pairs = ["<>","aA","bB"] return = false The closer b does not match the expected A. Constraints Every pair has length two. Pair characters are globally distinct. text.length <= 10^6.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Build two maps from the pairs: opener to closer, and a set of closers. Walk the text once. If the character is an opener, push its expected closer onto the stack. If it's a closer, the stack must be non-empty and the top must equal that character, otherwise return false. Pop on a match. Anything not in the maps gets skipped. At the end, return true only if the stack is empty. The pitfall is the example itself: in "x<aAb>y", the b opens, then > arrives while the stack expects B, so it fails. Forgetting the final empty check also breaks unclosed openers. Pushing the expected closer keeps the comparison simple. With text up to 10^6, one pass with O(n) stack is fine. Recursion would risk overflow, so use an explicit stack. If you freeze in the live OA, StealthCoder is the hedge that gets you the code.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Configurable Valid Brackets cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as valid parentheses. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Maven Clinic's OA.
Maven Clinic reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Configurable Valid Brackets FAQ
What's the trick in Configurable Valid Brackets?+
It's the classic valid parentheses stack, but the delimiter pairs come from input. Map each opener to its closer, push the expected closer when you see an opener, and compare on every closer. Characters outside the pairs get ignored. Return true only if the stack ends empty.
How hard is this one really?+
Easy to medium. If you've done valid parentheses, the only new part is building maps from the pairs array and skipping unrelated characters. The traps are the empty-stack check on a closer and the empty-stack check at the end.
Do letters count as delimiters here?+
Yes, if they appear in a pair. In the example, a, A, b and B are delimiters, so "aA" is a valid pair. Characters like x and y that appear in no pair are ignored. Pair characters are globally distinct, so no character plays two roles.
What about the 10^6 text length?+
One pass with a stack is O(n) time and O(n) space, which is fine. Use an iterative stack rather than recursion. Lookups should be hash maps or a small array, not scanning the pairs list per character.
How do I prepare for this in 48 hours?+
Write valid parentheses from memory twice, then rewrite it with a dynamic map built from a pairs array. Test unclosed openers, a stray closer on an empty stack, interleaved pairs like the example, and text with no delimiters at all.