Ad
  • Custom User Avatar

    I agree with you. This is more like a clever solution than best practice.

  • Custom User Avatar

    Most of the people who write the solution in a 8kyu kata are new programmers, many of them don't even know what O notation is, I guess it's the highest ranked because it's easy to understand and easy to think about it. Kata tests do not measure performance, so it is not a flag. I agree with the down buttons. but i think that the kata tests will have any performance input like a lot of inputs or timing. I submit the sort version to, because is the faster way to write the solution, are only to instructions.

  • Custom User Avatar

    Agree. I wish there were down votes too. It may be missleading especially for novice programmers.

  • Custom User Avatar

    Why is this a best practice? Sorting complexity for sorting is about and is O(n * log(n)) and just iterating through the array will take O(n) that faster and simplier, e.g. for 1 billion array list the number of iteration for sorting will be about 30 billions.

  • Custom User Avatar

    array_slice good decision. I forgot about it)

  • Custom User Avatar

    Test.assertEquals(solution(new Date('01/02/2008')), 4, '01/02/2008') should expect 5 not 4 (1 + 2 + 2). Am I right?