Expression Evaluation

1. Question

Given an expression string array, return the final result of this expression

Notice

The expression contains onlyinteger,+,-,*,/,(,).

Example

For the expression2*6-(23+7)/(1+2), input is

[
  "2", "*", "6", "-", "(",
  "23", "+", "7", ")", "/",
  "(", "1", "+", "2", ")"
],

return2

2. Implementation

3. Time & Space Complexity

时间复杂度: O(n), 空间复杂度: O(n)

Last updated

Was this helpful?