Evaluate Reverse Polish Notation

00:00
MediumStackMath
Amazon

Evaluate an expression in Reverse Polish Notation (postfix). Valid operators: +,-,*,/. Division truncates toward zero.

Examples

Input → ['2','1','+','3','*']
Output → 9
Note: 2+1*3
Input → ['4','13','5','/','+']
Output → 6
Note: 4+13/5
Input → ['10','6','9','3','+','-11','*','/','-2','1','+','*']
Output → 22