Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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)
This comment is hidden because it contains spoiler information about the solution
One of my previous attempts used a set rather than a vector, hence the
#include <set>
. It should really be#include <algorithm>
.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.
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.