Algorithm · Meta · Medium
Requirements Build an evaluator for an arithmetic-expression string containing +, -, , /, and parentheses (LC 224). One recent phone-screen form omits parentheses and instead emphasizes precedence and invalid-expression behavior, using inputs such as 12/3+24+1. Produce an integer result for valid expressions, with division rounded toward zero. Implement evaluate(expression: str) -> int None. The input is one expression string; invalid expressions return None. Examples…
Checking your access…