Evaluate an arithmetic expression written in Reverse Polish Notation (postfix form).
You are given an arithmetic expression in Reverse Polish Notation (RPN). In this notation, every operator follows its operands.
Your task is to evaluate the expression and return the final integer result.
Supported operators:
+ : addition- : subtraction* : multiplication/ : integer division that truncates toward zeroAssume the input expression is valid and there is exactly one final result.
+, -, *, /.Return a single integer: the value of the expression.
Example 1
Input
["2","1","+","3","*"]
Output
9
Explanation
First compute 2 + 1 = 3, then 3 * 3 = 9.
Example 2
Input
["4","13","5","/","+"]
Output
6
Explanation
First compute 13 / 5 = 2, then 4 + 2 = 6.
Example 3
Input
["10","6","9","3","+","-11","*","/","*","17","+","5","+"]
Output
22
Explanation
Evaluate the expression left to right using a stack of operands.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.