Quant Memo
Coding/●●●●

Evaluate an infix formula with parentheses

Asked at Optiver, IMC

Evaluate an arithmetic expression given as a plain string, honoring * / over + - and any nesting of parentheses.

"2 + 3 * (4 - 1)"  ->  11.0
"10 - 2 - 3"       ->  5.0

Return the numeric value of the expression. Support + - * /, parentheses, spaces, and multi-digit / decimal numbers.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions