The main reason that I voted to close wasn't because it wasn't unclear, but rather because it was very confusing. I just spent the last 5 minutes reading over the challenge and think that I have understood it, but I'm still not entirely sure.
But let's take a look at the two main parts that caused me to close it.
The contradiction
If the current line is -
, the next line is 1+2+ ... n-
n=4: -
=> 1+2+3+4-
If the last integer is equal to n, remove all integers from the end that are immediately followed by a -
, then change the last +
to a -
n=4: 1-2+3-4-
=> 1-2-
It seems to me as though 1+2+3+4-
is directly followed by 1-2+3-4-
which doesn't make sense to me. The steps that you have detailed, and the example you give, show that it happens much later than the first line. It would have definitely been clearer if you had used the first line as an example as it would have logically followed on. Instead I was trying to understand how you got to 1-2+3-4-
from 1+2+3+4-
.
n = 4: 1+2+3+4-
=> 1+2+3-
The mind twister
If the last integer is less than n, append the remaining integers with a +
after each one, except the final integer which should have a -
appended
The first few times I read this, I had no idea what it was saying. It was only after I read through it quite a few times, and used an example on a piece of paper that I understood what you were trying to say. This could definitely be phrased in a better and clearer way.
Your examples
I noticed that in this post and your comment on Peter Taylor's answer that you cite your examples as making your post clear. While I agree that they do contribute to its overall clarity, that's not what examples are supposed to do. From things to avoid when writing challenges
Test cases are examples for people to check their understanding of the spec and the correctness of their code. They should not replace an explanation of how the output must relate to the input.
As a final point (and as a cliché point), I would like to remind you of the Sandbox where you can post challenges to get feedback.
(As a side note, can I ask why the lines have to end with -
? It doesn't seem very mathematical and messes with my perfectionism.)