In some languages on Codewars (Python is the problem here, I think) it is possible to mutate the array that is passed as input. That will guarantee that the test will fail.
Generally it is not good to mutate the input to a function, unless that is the expected behaviour.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, Julian here!
There are two subtleties that catch out a great deal of the people who try this on Codewars.
The first is mentioned in this article, don't mutate the input.
The second is shown up by this combination: 3 3 3 3 2
That should score 300, but many people end up incorrectly giving 0 as the score.
Why do they give 0?!
The problem comes when there aren't exactly three of a number.
I guess that's no more contrived than the solution that would give 600 so that's okay.
What do you mean with "Don't mutate the input"? The variable that is given isn't changed, right?
In some languages on Codewars (Python is the problem here, I think) it is possible to mutate the array that is passed as input. That will guarantee that the test will fail.
Generally it is not good to mutate the input to a function, unless that is the expected behaviour.