Evaluate Reverse Polish Notation
Given an array of operators and operands in reverse Polish notation, evaluate its value.
We'll cover the following
Statement
Given an array of operators and operands representing an arithmetic expression in
Note: Valid operators are
+
,-
,*
, and/
. Each operand may be an integer or another expression.
Example
In the following example, we are given an array of operators and operands in reverse Polish notation which evaluates to 9
, as we can see from the illustration below:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.