Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, and /. Each operand may be an integer or another expression.
Note that division between two integers should truncate toward zero.
It is guaranteed that the given RPN expression is always valid. That means the expression would always evaluate to a result, and there will not be any division by zero operation.
計算用反向波蘭表示法表示的數學式的值。
合法的運算子有+
-
*
/
,每個運算元可能是一個整數或是另一個表達式。
注意兩個整數的除法應該要整除。
保證給定的表達式一定合法,這表示一定可以計算出結果且不會有除以零的操作。
LeetCode
C++