Basic calculator

Write codeHard30 minMeta and Google style

Your task

Implement a basic calculator that evaluates a string expression. The expression contains non-negative integers, '+', '-', '(' , ')', and spaces. Unary minus does not occur (every '-' is binary). Return the integer result. 1 <= len(s) <= 3*10^5 and the expression is always valid; the result fits in a signed 32-bit-safe range for these tests.

Examples

basic_calculator(s: str) -> int
Example 1
Inputbasic_calculator("(1+(4+5+2)-3)+(6+8)")
Output23