Ad
  • Custom User Avatar

    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.

  • Default User Avatar

    I had the same problem. Is it reallly a problem with our code or with the way codewars keeps track of global variables?

  • Custom User Avatar

    Kata has been retired

  • Custom User Avatar

    I have the next bext in the 2-nd part of tests:

    Test14
    expected:<[U]> but was:<[]>
    

    What does it mean? All of test in the 2-nd part (exception for this Test14) are completed

  • Custom User Avatar

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

  • Custom User Avatar

    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.

  • Custom User Avatar

    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 [].

  • Custom User Avatar

    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

  • Custom User Avatar

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

  • Custom User Avatar

    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)

  • Custom User Avatar

    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.

    maybe someone has the same problem?

    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

  • Custom User Avatar

    in the test there is text:

                           Incorrect result for "aabb"
                           Expected: equal to { 'a': 2, 'b': 2 }
                           Actual: { 'a': 4, 'b': 2 } 
    

    but my program returns 'a': 2, 'b': 2

    maybe someone has the same problem?