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.
30:00
Java
Evaluate Reverse Polish Notation
medium
Topics
Companies
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.
Example 1:
Input: {"tokens":["2","1","+","3","*"]}
Output: 9
Constraints:
1≤tokens.length≤104
Each token is either an operator +, -, *, /, or an integer in the range [−200,200].
Division between two integers truncates toward zero.