Ad
  • Custom User Avatar

    It's difficult to tell exactly what is wrong without seeing your code, but the most probable cause is that your solution relies on the sort being stable, while it's not guaranteed in Node version available on Codewars.

    If you read through the discourse of this kata, you will notice that many users experienced this problem, for example here: https://www.codewars.com/kata/55c6126177c9441a570000cc/discuss#614ae966bfd3cf00077029c3

    Some info on stability of Javascript sort: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#sort_stability

  • Custom User Avatar

    First of all, thanks for your answers... I tested my function in chrome to see what my function returns and it returns this:

    130 33 142 171 27 119 128 56 192 158 162214 104704 421801 88 52127 316460 44068 38372 440069 153674 316655

    What you think is correct and what I think is correct... So for the moment I don't understand why here the solution would not be functional

  • Custom User Avatar

    First of all, problems with your solution are not kata issue.

    Second thing is that you misinterpret the assertion message. It reads: "It should work for random tests too: expected actual value to equal expected value ". This would mean that your solution returns "130 153674 142 ...", while it should return "130 33 142 ...".

  • Default User Avatar

    Something you dont understand is not a kata issue, sorry!
    Are you sure of what you returned and of what is expected?

  • Custom User Avatar

    There is something I don't understand or I must have missed in the statement...

    I can pass the basic tests without any problems, but I can't pass the randoms...

    For example here is the string passed: "316460 142 421801 171 162214 119 440069 27 38372 192 52127 130 153674 88 316655 158 44068 33 104704 128 56"

    And this is what I am encountering as an error :

    It should work for random tests too: expected '130 153674 142 171 27 56 119 128 192 158 33 162214 88 104704 52127 316460 44068 38372 440069 316655 421801' to equal '130 33 142 171 27 119 128 56 192 158 104704 162214 421801 88 52127 316460 44068 38372 440069 153674 316655'

    How could 153674 be before 142 ?

    142 = 7
    153674 = 26

    If someone could help me I would be interested...