Ad
  • Default User Avatar

    That's because multiplication and division (or addition and subtraction) have the same priority.
    Operations with the same level of priority have to be read from left to right :
    3 + 6 - 2 - 6 + 1 - 8 = (((((3 + 6) - 2) - 6) + 1) - 8)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    One of my previous attempts used a set rather than a vector, hence the #include <set>. It should really be #include <algorithm>.

  • Custom User Avatar

    testSimpleProg for pass1 in C# is too specific, each expression can be represented by multiple Asts but only one is accepted.

    I initially had a program that prioritised brackets, multiplication, division, addition and subtraction in that order which passed testSimpleProg but failed testOpOrder. As it interpreted x - y - z + 1 - 1 as x - y - (z + 1) - 1. When I swapped around multiplication and division then addition and subtraction to change what the program prioritsed, testOpOrder would pass but testSimpleProg would fail since the Ast generated wasn't the one specifically asked for.

  • Custom User Avatar

    I've been trying to submit my code but keep running into exit code 139, response received but no data was written to STDOUT or STDERR. Please help, I really want to see if my code passes the more advanced tests.