Back to the 100
Problem 086Stack
Hard

Basic Calculator

086

Evaluate an expression containing non-negative integers, +, -, parentheses, and spaces.

EXAMPLES

Example 1
Input
{
  "s": "1 + 1"
}

Output
2

FUNCTION SHAPE

s: stringint
00:00
3 local tests readyRun with ⌘/Ctrl + Enter. Your code stays in this browser.

Runs solve(...) locally in a browser worker. SWE Playbook does not submit your code. Only run code you trust; Python code may access the network.