← 返回 meta 的题目列表Implement Basic Calculator Without Stack
类型:online_judge
meta
Implement a basic calculator that can evaluate a simple integer expression containing '+', '-', '(', and ')'. The implementation should not use stack.
Input Description:
Expression string s containing numbers 0-9 and operators '+', '-', '(', ')'. The expression does not contain any other characters. The expression length does not exceed 100.
Output Description:
Return the integer result of the evaluated expression.
Example 1:
Input: s = "(1+(4+5+2)-3)+(6+8)"
Output: 23
Constraints:
The input expression is valid for every operand and operator.
There are no spaces between numbers and operators.
Example
Input
(1+(4+5+2)-3)+(6+8)