Project Euler #93: Arithmetic expressions

  • + 0 comments

    Two observations that may help:

    1) A somewhat simple and algorithmical way to consider every parenthesis grouping is generating and evaluating every valid Postfix Expression.

    2) If you use floating point numbers, limited precission gives wrong answers for some tests. An alternative to using more precission, maybe a little more messy, is solving it using only integer numbers. That can be achieved if you use (integer) numerators and denominators in the operations (for example, you can implement a rational number class with two integer fields and all four operations)