Evaluate Reverse Polish Notation
Medium · Stack & Monotonic Stack · about 15 minutes
Asked at Amazon, LinkedIn, Google.
Evaluate an arithmetic expression given in Reverse Polish (postfix) notation as an array of tokens. Valid operators are +, -, * and /; each operand is an integer. Division truncates toward zero. The expression is always valid and never divides by zero.