Basic Calculator
hard
Given a string s representing an expression, implement a basic calculator to evaluate it.
Constraints
1. 1 <= s.length <= 3 * 10^5 2. s consists of digits, '+', '-', '(', ')', and ' '. 3. s represents a valid expression. 4. result of the expression always lies in range of -2^31 to 2^31
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
(1+(4+5+2)-3)+(6+8)
Sample Output
23
Question Video