This question evaluates a candidate's ability to parse and evaluate infix arithmetic expressions without parentheses, testing competency in expression parsing, operator precedence, multi-digit number handling, whitespace tolerance, integer division truncation, and edge-case validation.

Write evaluate(s: string) to compute the value of an arithmetic expression containing non-negative integers, '+', '-', '', '/', and spaces, with operator precedence ( and / before + and -) and no parentheses. Division truncates toward zero. Aim for a single pass with O(