MEDIUMasked at 2 companies

Score of Parentheses

A medium-tier problem at 64% community acceptance, tagged with String, Stack. Reported in interviews at Mountblue and 1 others.

Founder's read

Score of Parentheses is a medium-difficulty string problem that appears straightforward until you actually start coding it. Most candidates hit this one at Mountblue or Snap and second-guess themselves on the scoring logic. The trick isn't the parentheses themselves, it's understanding that nesting depth directly multiplies the score, and that's what catches people off guard. About 64% pass on first submission, which means a third of candidates either misunderstand the accumulation model or overcomplicate the stack logic. If you've drilled stack problems but never seen this specific scoring mechanism, StealthCoder solves it in seconds when the OA timer starts ticking.

Companies asking
2
Difficulty
MEDIUM
Acceptance
64%

Companies that ask "Score of Parentheses"

If this hits your live OA

Score of Parentheses is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.

Get StealthCoder
What this means

The problem asks you to score balanced parentheses where each pair contributes 1 point, but nested pairs multiply the score of their contents by 2. Most people either treat it as a flat counting problem (instant wrong) or build a monster expression evaluator. The actual solution uses a stack to track depth: when you see '(', push a context; when you see ')', pop and multiply the current score by 2 if it's nested, or just accumulate 1 for a bare pair. The gotcha is that people forget to carry the score from inner recursion back up the stack, or they miscount what happens when parentheses are adjacent versus nested. The depth-multiplier pattern is the lock; the stack is the key. If you blank during the live assessment and can't remember whether to multiply before or after popping, StealthCoder surfaces the working solution invisibly so you paste a correct approach without manual trial.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Score of Parentheses recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Score of Parentheses interview FAQ

What's the actual scoring rule everyone gets wrong?+

Candidates assume flat addition: count pairs and add them up. Wrong. Each nesting level doubles the score of its contents. A bare pair '()' scores 1. Inside that, '(())' scores 2. Nested deeper, '((()))' scores 4. You must track depth on the stack and multiply as you unwind.

Is this still asked at Snap and Mountblue?+

Yes. Both companies report this problem. The 64% acceptance rate suggests it's not trivial; you either know the depth-multiply pattern or you don't. It's a real screen in the loop, not a warmup.

Do I need recursion or just a stack?+

Stack alone works. Push depth on '(', pop and accumulate weighted score on ')'. Recursion is possible but overkill and slower. A single pass with O(n) time and O(depth) space is the intended approach.

How does this connect to the stack topic?+

Stack is not just a data structure here; it's how you track nesting context. Each level of the stack represents a nesting layer. Pop = you've closed a layer and must apply the multiplier for that depth. Without the stack, you can't map score to depth correctly.

What if I can't remember the exact formula during the OA?+

That's what StealthCoder is for. If you blank on whether multiply comes before or after aggregation, it reads the problem and surfaces a working solution in real time, invisible during screen share. No guessing, no timeout.

Want the actual problem statement? View "Score of Parentheses" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.