Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 512 Bytes

File metadata and controls

12 lines (9 loc) · 512 Bytes

Problem 8: Postfix Computation

Problem Statement

Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, and /. Each operand may be an integer or another expression. Division between two integers should truncate toward zero. It is guaranteed that the given RPN expression is always valid.

Input Format

  • An array of strings tokens.

Example

Input: tokens = ["2", "1", "+", "3", "*"]
Output: 9
Explanation: ((2 + 1) * 3) = 9.