Ad
  • Custom User Avatar

    Your task is to sum the differences between consecutive pairs in the array in descending order.

    [[1, 1, 1, 0, 0]] <- it's already in descending order
    (1 - 1) + (1 - 1) + (1 - 0) + (0 - 0) = 1
    
  • Custom User Avatar

    Reading the description, it is fine for the Ruby version it was originally written for over a decade ago. On the one hand, I'd somewhat agree with the other language versions stating to capitalize the first letter, but any clarification needed is given in the examples of given input and expected output.

  • Custom User Avatar

    This error happens when, for example, you try to parseInt a string that's too long and wouldn't fit the datatype. You should find more info where the error came from if you follow the stack trace.

  • Custom User Avatar

    Language is not relevant here. It's implementation problem.

  • Custom User Avatar

    No, you didn't (or at least, no with your current java code), if you have an empty array and n = 4, your code tries to return a 4 (currently 5) elements array, not an empty one. Also note this error:

    Index 3 out of bounds for length 3
    

    You're doing something wrong there.

  • Custom User Avatar

    Well, you just got to apply some logic, and there are also fixed tests that show you expected result.

    What's the result of taking 0 items of any array? What's the result of taking 100 items of an empty array? In both cases it's just an empty array.

  • Custom User Avatar

    Well, I agree that the " be ready for anything else which is not clearly specified" is really poor style and should not be there, but come on, if the caller requests two elements, then how can be interpreted differently than, duh, returning two elements?

    When n is smaller than the signature array length, you did not specify the desired behavior.

    I don;t think it's true. Signature length does not directly affect what are the first two elements of the sequence.

  • Custom User Avatar

    You'll have to flush your print to see it in that case:

    print(some_var, flush=True)
    

    You're in this case: https://docs.codewars.com/training/troubleshooting#no-print

  • Custom User Avatar

    Read the conditions again and fix your code. It's timing out because it doesn't pass some edge cases.

  • Custom User Avatar

    How is this not an array?

    public class Kata
    {
      public static int SumMix(object[] x)
      {
        
      }
    }
    
  • Custom User Avatar

    what rounding? 1.2 x 50 is exactly 60, add 6 and you get 66...

  • Custom User Avatar

    It is not meant to. Figuring out how to put three sticks together to form a triangle is a part of the exercise.

  • Custom User Avatar

    Seriously, while ranting, you need to explain a bit better what you consider a problem because from all the complaints until now, all I've seen is you saying "this is wrong" about somethign what does not really appear wrong at the first sight. Call me stupid, but how is 1,2,9 -> false misleading? You cannot have a triangle with sides of 1, 2, and 9, so the expected answer is false. What exactly is wrong with it?