Evaluate Reverse Polish Notation

Implement an evaluator for a Reverse Polish Notation (RPN) expression.

The input is a space-separated sequence of tokens. A token is either an integer or one of the binary operators +, -, *, an...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: