In this problem we’re given an array of strings tokens that represents a vlid arithmetic expression in Reverse Polish Notation.
Example
Approach 1
Create a variable to hold our result stack and create loop to iterate over input list
Since our conditions are dependent on encountering the operators +, -, *, /, we can create a set to hold our operators
We start by iterating over the list and checking if the current token is not an operator, if its not we know its a number and can append it to our result stack.
If it is an operator we pop the last two values and perform the operation
finally we append the result to the result stack and continue to the next token