Coding Challenge

Evaluate Reverse Polish Notation

Medium
stack

Evaluate an arithmetic expression in postfix notation.

Given tokens in Reverse Polish Notation, evaluate the expression and return the integer result.

Examples

Input: tokens = ["2","1","+","3","*"]

Output: 9

Constraints

  • Operators are +, -, *, /
  • Division truncates toward zero

Preparing your coding workspace...