← Questions

Basic calculator II

0
MetaAmazonGlean+1CodingLast asked Sep 2026

Evaluate a string expression of non-negative integers with +, -, *, / and spaces, no parentheses, respecting precedence (integer division truncates toward zero).

Variants reported: only + and *; do it without a stack in constant extra space by carrying the last term; and talk through how you would add parentheses.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding