FastPrepEvaluate a Parenthesized Integer Expression
Problems/Evaluate a Parenthesized Integer Expression

Evaluate a Parenthesized Integer Expression

Adobe logoAdobe● HardFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A reported technical screening asked for a calculator that evaluates an integer expression. The report named the task but did not give the full function signature. We chose the function signature, the rule for a plus or minus sign in front of a number, the limits, and the examples. Our version is about 92% the same as the reported question.

Evaluate the integer expression in expression.

The expression contains non-negative decimal integers, the binary operators + and -, parentheses, and spaces. A + or - may also appear as a unary sign, including immediately before a parenthesized expression.

Use integer arithmetic and return the value of the complete expression. Do not call a language-provided expression evaluator.

Function

calculate(expression: String) → int

Examples

Example 1

expression = "1 + 1"return = 2

Adding the two operands gives 2.

Example 2

expression = "(1+(4+5+2)-3)+(6+8)"return = 23

The two outer groups evaluate to 9 and 14.

Example 3

expression = "-(2 + 3) + 10"return = 5

The unary minus negates the parenthesized value 5.

Constraints

  • 1 <= expression.length <= 100000
  • expression is a valid expression containing digits, spaces, +, -, (, and ).
  • Every intermediate value and the final answer fit in a signed 32-bit integer.

Source note: The source image is a source-neutral excerpt of the author-reported prompt.

More Adobe Phone Screen questions

  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026
  • All Safe Boards for N QueensPHONE SCREEN · Seen Jun 2026

Similar questions at other companies

  • Parse Boolean Rule ExpressionsStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
  • Arithmetic Expression EvaluatorMicrosoft · PHONE SCREENMicrosoft interview questions
  • Arithmetic Expression CalculatorSnowflake · PHONE SCREENSnowflake interview questions
  • Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Remove Parentheses from a Plus-Minus ExpressionOracle · PHONE SCREENOracle interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Decode StringCompass International Holdings · PHONE SCREENCompass International Holdings interview questions
  • Rich Text Parser Part 3 (Depth Tokens)Figma · PHONE SCREEN · ONSITE INTERVIEWFigma interview questions
  • Calculator with ParenthesesGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Decode an Encoded StringAmazon · PHONE SCREEN · ONSITE INTERVIEW

Interview reports that mention this question

  • Adobe C++ Engineer Round 1: 9 Experiences (Part 8 of 12)

Adobe interview experiences

  • Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public int calculate(String expression) {
      // Write your code here.
    }
}
Checking account…