Problem 1307. RPN Calculator for simple arithmetic expressions
Solution Stats
Problem Comments
-
6 Comments
in your test suite it seems odd that rpz('a','b','-') is interpreted as 'a-b' while rpz('a','b','/') is interpreted as 'b/a' (instead of 'a/b'). Same goes for rpz('a','b','%') which is interpreted as 'b%a' instead of 'a%b'. Last, your last test case rpn(z(1),'+',z(2),'*',z(1),z(3),'-',z(4),z(5),'%','*') is plain weird... it should probably read rpn(z(1),z(2),'+',z(1),'*',z(3),'-',z(4),z(5),'%','*') instead...
Thank you for your comments; I will update the description and fix last test case.
I will retire the last test case for the problem.
I have an rpn solver but it only accepts strings
Would someone please check the first test? The variable z is commented out.
Chris, the format of the test cases has been corrected, you can attempt the question now.
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2749 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3384 Solvers
-
14661 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
613 Solvers
-
Is this triangle right-angled?
5987 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!