2020-09-29 10:22:14 +02:00
# reverse-polish-notation
2023-07-02 17:28:54 +02:00
Created by [@theoludwig ](https://github.com/theoludwig ) on 29 September 2020.
2020-09-29 10:22:14 +02:00
2020-12-09 12:42:12 +01:00
## Instructions
2020-09-29 10:22:14 +02:00
Your job is to create a calculator which evaluates expressions in Reverse Polish notation (a mathematical notation in which operators follow their operands. It does not need any parentheses as long as each operator has a fixed number of operands).
2021-10-12 22:48:23 +02:00
For example expression 5 3 + (which is equivalent to 5 + 3 in normal notation) should evaluate to 8.
2020-09-29 10:22:14 +02:00
For your convenience, the input is formatted such that a space is provided between every token.
Empty expression should evaluate to 0.
2020-11-15 10:56:27 +01:00
Valid operations are +, -, \*, /.
2020-09-29 10:22:14 +02:00
You may assume that there won't be exceptional situations (like stack underflow or division by zero).
2021-10-12 22:48:23 +02:00
All the numbers are integers; you don't need to worry about floating point numbers.
2020-12-09 12:42:12 +01:00
## Source
2020-09-29 10:22:14 +02:00
- [Reverse polish notation - Codewars ](https://www.codewars.com/kata/52f78966747862fc9a0009ae )
2020-12-09 12:42:12 +01:00
## Examples
2020-09-29 10:22:14 +02:00
2021-06-09 20:31:45 +02:00
See the `test` folder for examples of input/output.