Basic Calculator
Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. The expression string may contain open ( and closing ) parentheses, the plus + or minus - sign, non-negative integers and empty spaces.
Basic Calculator

Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. The expression string may contain open ( and closing ) parentheses, the plus + or minus - sign, non-negative integers and empty spaces.

Example 1:
Input: "(1+(4+5+2)-3)+(6+8)"
Output: 23
Input
arr ="(1+(4+5+2)-3)+(6+8)"
Expression

(

1

+

(

4

+

5

+

2

)

-

3

)

+

(

6

+

8

)

num
0
sign
+
result
0
Stack (result, sign pairs)

Empty

Initialize: result=0, sign=1

Variables
VariableValue
result0
sign1
DepthFunction Call
Stack empty
0/20