Ad
  • Custom User Avatar

    Wow! Thanks! Didn't understand how to approach this one so solved the one you recommended first and now the solution for this one is clear to me :)

  • Custom User Avatar

    It is not clearly specified how we should treat spaces. In some random tests, we got multiple adjacent spaces. To me it seems we should ignore any empty words we might get when splitting the text into words.

  • Custom User Avatar

    Hi catchaser, yes, you are right, the result must be 68. I don't understand why you are seeing this (all test cases expect "0"), I just checked and everything works fine for me. Probably something wrong with codewars' test runners? Are you using Node v10.x?

  • Custom User Avatar

    What was the callback function?

  • Custom User Avatar

    A = [1,3,3], sum = 2 returns false. You cannot use 1 twice.

    That example shows that numbers can be repeated, or do you mean something else?

  • Custom User Avatar

    It's generally considered a bad practice if function mutates its parameters passed as input. Otherwise, every time some caller calls your function, they have to assume that after the call parameters are changed or in some way destroyed and cannot be used anymore.

  • Default User Avatar

    Since the result is not unique the "testing" function don't verify that the arrays are the same but that the result is correctly sorted and that the sum of the squares is correct.