← OtterAI Interview Insights

OtterAI·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Did a technical screen for a Software Engineer role at OtterAI. The main question was fine but the follow-up was a harder calculator problem and I ran out of time, ended up just writing pseudo code which felt pretty rough.

Questions Asked (1)

Q1

Implement a basic calculator that supports nested expressions, including parentheses and all four arithmetic operators.

Algorithms & Data Structures
Author's notes

Ran out of time and resorted to pseudo code.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a stack-based approach to handle nested parentheses and operator precedence. Iterate through the expression, maintaining a stack of previous results and signs, and a running result for the current parenthesis level. When encountering a digit, parse the full number and apply the current operator to the running result.

Pro tip: Clarify edge cases upfront, such as negative numbers, spaces, and division by zero, to show thoroughness. Also, mention that you can extend the solution to support more operators or functions if needed.

1. Clarify requirements and edge cases

Ask about input format (e.g., spaces, negative numbers, division by zero) and expected output. Confirm that the calculator should follow standard operator precedence and handle nested parentheses.

2. Choose data structures and algorithm

Decide on a stack-based approach to manage nested expressions and operator precedence. Alternatively, consider recursion or two-stack (operands and operators) methods.

3. Outline the algorithm

Describe how to iterate through the string, parse numbers, handle operators, and manage parentheses using a stack. Explain how to update the result and sign when encountering '(' and ')'.

4. Implement and test

Write clean code with meaningful variable names. Test with simple and complex expressions, including nested parentheses and multiple operators.

5. Analyze complexity and discuss optimizations

State time and space complexity (O(n) time, O(n) space for stack). Discuss potential optimizations or alternative approaches if relevant.

Key Points to Mention

  • Handling operator precedence (multiplication/division before addition/subtraction)
  • Using a stack to manage nested parentheses and intermediate results
  • Parsing multi-digit numbers correctly
  • Dealing with spaces and negative numbers
  • Time and space complexity analysis
  • Edge cases: division by zero, empty input, unbalanced parentheses

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.