← Back to challenges

Reverse Polish Notation

PythonHardalgebraalgorithms

Instructions

Create a function to emulate a Reverse Polish Notation calculator.

Examples

rpn([1, 2, "*", 4,5, "*" , "+"]) ➞ 22

rpn([1,1,"+"]) ➞ 2

rpn([16,16, "/" ]) ➞ 1
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.