Reported August 2026
Capital Onestring

Minimize Expression Value with Parentheses

Reported by candidates from Capital One's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Capital One OA. Under 2s to a working solution.
Founder's read

The Capital One OA reported in August 2026 has a parentheses problem that looks trivial and then bites you on the empty-factor case. You get a string like 741+12, place one pair of parentheses around the plus sign, and return the minimum value. It's brute force over split points, and the expression is at most 10 characters. The trap isn't the algorithm. It's forgetting that a missing factor counts as 1, not 0. If you blank on the setup during the live assessment, StealthCoder runs invisibly as a safety net and gives you the working loop.

The problem

You are given a string expr representing the sum of two positive decimal integers. Neither integer contains the digit 0.
Insert exactly one pair of parentheses so that the plus sign is inside the parentheses and at least one digit lies between each parenthesis and the plus sign.
Digits before the left parenthesis form a left multiplication factor, and digits after the right parenthesis form a right multiplication factor. If either factor is absent, use 1. The digits inside the parentheses form the two addends.
For example, 741+12 may become 74(1+1)2, which has value 74 * (1 + 1) * 2 = 296.
Return the minimum numeric value over all valid placements of the parentheses.

Function
minimizeExpressionValueWithParentheses(expr: String) → int

Examples
Example 1
expr = "741+12"
return = 296
The placement 74(1+1)2 evaluates to 74 * 2 * 2 = 296. Every other valid placement has a value of at least 296.
Example 2
expr = "247+38"
return = 170
Placing the parentheses as 2(47+38) gives 2 * 85 = 170, which is minimal.
Example 3
expr = "999+999"
return = 1998
Enclosing both complete numbers gives (999+999) = 1998. Leaving any digit outside introduces a factor that makes the value larger.

Constraints
3 <= expr.length <= 10.
expr contains exactly one plus sign.
At least one digit appears on each side of the plus sign.
Every digit in expr is between 1 and 9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Split expr at the plus into left string A and right string B. Try every left-paren position i from 0 to len(A)-1 and every right-paren position j from 1 to len(B), so at least one digit sits inside on each side. Left factor is A[:i], or 1 if empty. Left addend is A[i:]. Right addend is B[:j]. Right factor is B[j:], or 1 if empty. Compute leftFactor * (leftAdd + rightAdd) * rightFactor and keep the minimum. The common pitfall is treating an empty substring as 0, which makes everything evaluate to 0 and return the wrong answer. Parse with int() only after checking for empty. With at most 10 characters, the search is tiny, so don't optimize. Check your loop bounds against example 3, 999+999, where the answer is 1998 with nothing outside. StealthCoder is the hedge if the index math scrambles under the clock.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Minimize Expression Value with Parentheses 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. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as minimize result by adding parentheses to expression. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Capital One's OA.

Capital One reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Minimize Expression Value with Parentheses FAQ

What's the trick in the Capital One minimize expression value problem?+

There's no clever trick. It's brute force over every valid pair of parenthesis positions. The real work is getting the empty-factor rule right, where a missing left or right factor becomes 1. Get that and the loops, and you're done.

How hard is this OA question really?+

Easy to medium. The input is at most 10 characters, so complexity doesn't matter. Most failures come from off-by-one errors in the split indices or from treating an empty factor as 0 instead of 1.

How do I enumerate the valid parenthesis placements?+

Split on the plus sign. For the left number, the open paren can sit before any digit, from index 0 to len-1. For the right number, the close paren sits after at least one digit, from 1 to len. Every combination of the two is valid.

What edge cases should I test before submitting?+

Test 999+999 where the best answer encloses everything and no factors exist. Test the smallest input, like 1+1. Test a case where the best placement leaves digits on only one side. These catch the empty-factor bug and bad loop bounds.

How do I prepare for this in 48 hours?+

Write the solution once from scratch on the three given examples. Practice string slicing and the empty-to-1 conversion until it's automatic. That's about 20 minutes of work. Spend the remaining time on other likely Capital One string and array problems.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Capital One.

OA at Capital One?
Invisible during screen share
Get it