Python data engineering interview problem. Difficulty: intermediate. Pattern: Stacks. About 14 minutes. Part of the Pro drill bank.
Evaluate a Reverse Polish Notation expression. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement eval_rpn(tokens: list) -> int for +, -, *, / (truncate toward zero).
Input: eval_rpn(['2', '1', '+', '3', '*']) Output: 9 (2+1)*3 = 9.
Topics: lakebench, python, rpn, eval.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Evaluate a Reverse Polish Notation expression.
Implement `eval_rpn(tokens: list) -> int` for +, -, *, / (truncate toward zero). Example: `["2", "1", "+", "3", "*"]` → `9`. Keep the harness.