From 18981b54af187fe75fa9a650777af3aee15149fb Mon Sep 17 00:00:00 2001 From: Rohit Tanwar <31792358+kriadmin@users.noreply.github.com> Date: Wed, 3 Jan 2018 09:03:45 +0530 Subject: [PATCH] Add the list of supported operator Add the list of supported operators and specify that unary operators are not supported. Also tell that `^` & `**` are the same and are exponential operators(as `^` can be confused to be the xOR symbol) --- snippets/solveRPN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/solveRPN.md b/snippets/solveRPN.md index 099be512a..87a1fee3f 100644 --- a/snippets/solveRPN.md +++ b/snippets/solveRPN.md @@ -1,7 +1,7 @@ ### solveRPN Solves the given mathematical expression in [reverse polish notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation). -Throws appropriate errors if there are unrecognized symbols or the expression is wrong. +Throws appropriate errors if there are unrecognized symbols or the expression is wrong. The valid operators are :- `+`,`-`,`*`,`/`,`^`,`**` (`^`&`**` are the exponential symbols and are same). This snippet does not supports any unary operators. Use a dictionary, `OPERATORS` to specify each operator's matching mathematical operation. Use `String.replace()` with a regular expression to replace `^` with `**`, `String.split()` to tokenize the string and `Array.filter()` to remove empty tokens.