← Back to challenges

Fix the Right Answer

JavaScriptHardmathstrings

Instructions

Create a function that takes a string and returns the right answer.

Examples

postfix("2 2 +") ➞ 4

postfix("2 2 /") ➞ 1

postfix("8 4 / 9 * 3 1 * /") ➞ 54

Notes

  • The operators + - * / may be supported.
  • Output always returns an integer.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.