You are given an array of strings tokens representing an arithmetic expression in Reverse Polish Notation (postfix). Evaluate the expression and return the result as an integer. Valid operators are +, -, , /. Division truncates toward zero.
Input: tokens = ["2","1","+","3","*"]
Output: 9
Explanation: ((2 + 1) * 3) = 9.
Topics: stack, arrays
Asked by: Amazon, Google, LinkedIn
Time complexity: O(n). Space complexity: O(n).