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.
It's a problem with your code, CodeWars doesn't do anything special about global vars, it works the same everywhere. Try calling your function more than once in other place and the result will be the same.
I had the same problem. Is it reallly a problem with our code or with the way codewars keeps track of global variables?
Kata has been retired
I have the next bext in the 2-nd part of tests:
What does it mean? All of test in the 2-nd part (exception for this Test14) are completed
This comment is hidden because it contains spoiler information about the solution
So it's just my inattention. It's something funny to feel that my mistake was not in the code but in the ability to read the terms)
Thanks for your reply because of I thought that 2-3 hours only on finding mistake were without effect.
Just glancing at your code, it looks to me that you remove opposite directions, no matter where they are in the array. That's not correct, because for this kata the rule is to only remove opposite directions if they are next to each other (adjacent).
This is why, for example: for ["NORTH", "WEST", "SOUTH", "EAST"]: the result is the same, and not [].
Glad to hear you found the problem. It's always best to see how many users solved a kata in your language. If the number is high, it's almost always problem with your code, and not kata tests :P
This comment is hidden because it contains spoiler information about the solution
Yeah , it was truth about global variable.
I choose it as issue because of my experiance. I thought that it's an issue, not a question.
Thanks for your useful reply)
Maybe you use some global variable that keeps values throughout tests? It could explain why it works for 1 test, but not a few in a row.
How is that a kata issue? It's not, rather a question (so I'm closing it). We can't read your code or your mind to know why it's returning incorrect results, so you should provide more information.
This article has some answers to similar questions like yours: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution
in the test there is text:
but my program returns 'a': 2, 'b': 2
maybe someone has the same problem?