150 Evaluate Reverse Polish Notation
1. Question
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are+
,-
,*
,/
. Each operand may be an integer or another expression.
Some examples:
2. Implementation
思路: 当遇到运算符时,要处理前面的数字,所以用stack
3. Time & Space Complexity
时间和空间都是O(n)
Last updated