← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Uber coding interview for a Software Engineer role. The main problem was a recursive expression parser, which is already a pain, but they added a twist where you also have to handle malformed input and return an error indicator. Not a relaxing afternoon.

Questions Asked (1)

Q1

Given a string representing a Lisp-style expression with let, add, and mult operations, evaluate it and return the result. Additionally, handle syntactically invalid inputs (mismatched parentheses, unknown tokens, etc.) and return an appropriate error indicator.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The base problem is already one of those recursive parsing questions that looks manageable until you actually try to write it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the grammar and error handling expectations, then propose a recursive descent parser that evaluates expressions on the fly. Emphasize robust error detection with clear error indicators and discuss trade-offs between parsing strategies.

Pro tip: Mention that you would define a formal grammar first and use it to guide both parsing and error handling, showing a systematic approach that impresses interviewers.

1. Clarify Requirements and Grammar

Ask about the exact syntax, supported operations, and how errors should be indicated. Define a formal grammar for the expressions.

2. Design Parsing Strategy

Choose a recursive descent parser for simplicity and direct evaluation. Discuss tokenization and handling of nested expressions.

3. Implement Evaluation with Error Handling

Write functions for each grammar rule that return either a value or an error. Propagate errors and validate tokens, parentheses, and operand types.

4. Test and Validate

Walk through test cases including valid expressions, mismatched parentheses, unknown tokens, and division by zero (if applicable).

5. Discuss Trade-offs and Extensions

Compare recursive descent with other parsing methods (e.g., stack-based) and mention how to extend for more operations or variables.

Key Points to Mention

  • Define a clear grammar for the Lisp-style expressions (e.g., EBNF).
  • Use recursive descent parsing for direct evaluation and easy error handling.
  • Implement robust error detection: mismatched parentheses, unknown tokens, invalid operands.
  • Return a sentinel value or throw a custom exception to indicate errors.
  • Consider edge cases: empty input, nested expressions, division by zero.
  • Discuss time and space complexity: O(n) time, O(d) space for recursion depth.

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