Evaluate Reverse Polish Notation

来源:互联网 发布:淘宝店铺能不能转让 编辑:程序博客网 时间:2024/06/09 21:33
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", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6



0 0
原创粉丝点击