Deutsche Bank Off-Campus OA 2022 | Expression Evaluation Using Stack-Based Parsing and Operator Precedence Optimization
Question · Posted Jun 2026
Problem Statement Given a string s representing a valid arithmetic expression, evaluate and return its value. The expression contains: Non-negative integers Addition (+) Subtraction (-) Multiplication (*) Division (/) Rules Division truncates toward zero. No parentheses are present. The expression is always valid. Spaces may appear in the input. Example 1 Input: s = "3+2*2" Output: 7 Explanation 2 * 2 = 4 3 + 4 = 7 Example 2 Input: s = " 3/2 " Output: 1 Example 3 ...
The full answer & interview discussion are available to premium members.
Log in Create a free account