Meta·Machine Learning Engineer·Technical Phone Screen
- Implement a calculator that evaluates an arithmetic expression string containing only non-negative integers, '+', '*', and optional whitespace. No parentheses. Standard operator precedence applies (multiplication before addition). Provide both a split-based solution and a single-pass O(1)-space solution, and explain the tradeoffs.
“The split approach clicked fast: split on '+', then for each chunk split on '*' and multiply across, then sum everything.”