Evaluate an expression in Reverse Polish Notation. Valid operators are +, -, *, and /. Each operand may be an integer or another expression. Division between two integers always truncates toward zero.
tokens = ["2","1","+","3","*"]9tokens = ["4","13","5","/","+"]6+, -, *, /stack, scan tokens left→rightstack.push(parseInt(t))b = stack.pop(), a = stack.pop()a OP b, push result back onto stackstack.pop() — the single remaining elementRPN (postfix notation) is designed for stack evaluation. Operands wait on the stack until their operator arrives. When an operator appears, it always applies to the two most recent values — no parentheses or precedence rules needed. Stack size is at most O(n/2) for a balanced expression.