HARDasked at 10 companies

Basic Calculator III

A hard-tier problem at 52% community acceptance, tagged with Math, String, Stack. Reported in interviews at Houzz and 9 others.

Founder's read

Basic Calculator III shows up at DoorDash, Snap, Brex, TikTok, and seven other major companies. You're parsing a string with numbers, plus, minus, multiply, divide, and parentheses. The acceptance rate sits at 52%, meaning half the candidates either tank the implementation or get tripped up by operator precedence and recursion. This is a real filter problem. If you hit this during a live assessment and freeze on how to handle nested parens or operation order, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
10
Difficulty
HARD
Acceptance
52%

Companies that ask "Basic Calculator III"

If this hits your live OA

Basic Calculator III 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 Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The trap is thinking you can just scan left-to-right and apply operations in order. You can't. Multiplication and division bind tighter than plus and minus. You also need to handle parentheses, which forces recursion or a stack-based parser. Most candidates start building a simple state machine and realize halfway through they're missing operator precedence. The algorithm: tokenize the string, use a stack to store numbers, track the last operator, and when you hit a lower-precedence operator (or end of string), resolve pending multiplications and divisions. Parentheses require recursion: when you see '(', recursively parse the subexpression and treat the result as a single number. The String and Math topics are a red herring. This is a Stack and Recursion problem disguised as arithmetic. StealthCoder is your hedge for the one pattern you didn't drill because the problem statement looks deceptively simple.

Pattern tags

The honest play

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

Basic Calculator III recycles across companies for a reason. It's hard-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 Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Basic Calculator III interview FAQ

How hard is Basic Calculator III really compared to other parsing problems?+

It's harder than basic string parsing but not as brutal as full expression evaluation with custom functions. The 52% acceptance rate reflects that operator precedence and recursion handling trip up half the field. Most candidates can outline the approach but crash on implementation details like how to defer multiply/divide operations.

Do I actually need recursion or can I solve it with just a stack?+

You need recursion if you want clean, readable code for parentheses handling. Some candidates use an index-based recursive parser. Others use a stack and manually track nesting depth. Both work. Recursion is more intuitive. Stack-only is slightly faster but easier to mess up.

What's the biggest gotcha in this problem?+

Forgetting that multiply and divide must execute before plus and minus. Candidates often build a simple accumulator and apply operations in reading order, which breaks on mixed precedence. The fix: push numbers to a stack, defer low-precedence operations until you see a higher-precedence or end-of-string signal.

Is Basic Calculator III still asked at DoorDash, Brex, and TikTok?+

Yes. It appears in reports from all three, plus Snap, Oracle, Houzz, Hulu, and others. It's a standard filter for mid-level and senior backend roles. Expect it in online assessments before technical rounds, not phone screens.

How long should I spend on this in a real OA?+

You can't claim time limits. Realistically, 20 to 30 minutes if you know the stack pattern well. If you hit a wall on precedence or recursion, that's where you lose time. Have a working stack-based solution ready before the assessment, or know exactly where StealthCoder steps in.

Want the actual problem statement? View "Basic Calculator III" 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.