Dsa
Stack
Hard
Evaluate Reverse Polish Notation
Implement a program that evaluates the value of an arithmetic expression in Reverse Polish notation (RPN). The expression is represented as an array of strings where each string is either an operand or an operator. Valid operators are '+', '-', '*', and '/'. Return the final result of the expression.
Input format:
A single line with space-separated tokens representing the RPN expression.
Output format:
Print a single integer result of the evaluated expression.
Example:
Input:
2 1 + 3 *
Output:
9
Key concepts
stackrpnevaluation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now