Stack | Learn for Master
• ### Convert infix notation to reverse polish notation (Java)

How to implement a calculator is a popular interview question. To answer this question well, you need to maser Stack data structures, convert an infix notation to RPN and evaluate reverse polish notation.

Since the input is usually in infix notation, e.g. “3 + 6 * 2”, it is difficult develop a program to evaluate it directly.

In practice, we can implement a calculator algorithm into two steps:

1. the first step is to convert your mathematical expressions, which is called infix notation, into Reverse Polish Notation (RPN),
• ### LeetCode- Evaluate Reverse Polish Notation (Java)

[LeetCode] Evaluate Reverse Polish Notation (RPN)
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Some examples:

Analysis

Evaluate RPN is the second step to build a calculator. Once we have converted the infix expression into the RPN,  we need to evaluate RPN to get the result.

The basic idea to evaluate reverse polish notation is to use a stack to process the strings.

We scan the array of the RPN expression.