Browse and switch challenges
Expression Evaluator
Evaluate an expression containing non-negative integers, '+'
, '-'
, '*'
, '/'
, parentheses, and spaces. Division truncates toward zero.
Important
- -Respect operator precedence and parentheses.
- -All numbers are non-negative integers.
Signature
Constraints
- -
|expr| ≤ 5e4
- -
values fit in 32-bit signed int
Examples
System prompt
0 tokens
Read-only
// Waiting for generated code…
// Your output will appear here as soon as the model returns JavaScript.
// It must define function calc(…)
.
// Tip: write a prompt on the left and click "Generate code" .
0 tokens
Submission #1
0tokens(0/0)
Leaderboard
Loading leaderboard...