Ad
  • Default User Avatar

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

  • Custom User Avatar

    I would not bet on modifcation of input, because in the default setup, the input vector is passed by value what causes that modifications would not be visible to the caller (i.e. tests), unless user changed signature of the function and made it accept the vector by non-const reference.

    Anyway, sharing your code here (remember about code formatting and spoiler flag) would allow us to see what's wrong and fix potential issues with the kata.

  • Custom User Avatar

    Maybe I have not been clear, so I'll try to reword it: the problem is probably that you modify the input, while you should not do that. For this reason, I suspect the tests expect a wrong result. However, as I told you, the tests normally never expect a negative value. This kata has been solved nearly a 1000 times in C++ and such an issue has never been reported, so you must do something badly. If you want further help you can post your code with a spoiler flag.

  • Default User Avatar

    the
    "Expected: equal to -652
    Actual: 978"
    is an error that the test is giving me, its not calculated by me...
    my output is 978 while the random tests tell me that the output should be -652

  • Custom User Avatar

    .

  • Custom User Avatar

    You must modify the input. Please check it. I've just tried again my solution, it works nicely and cannot return a negative value since it returns an unsigned.

  • Default User Avatar

    C++ kata is having major issues:

    INPUT:
    -67|287
    249|441
    -457|211
    -271|133
    -491|-431
    -203|215
    481|487
    400|484
    -70|305
    -486|210
    -133|69
    -394|-233
    -219|80
    174|462
    -342|-321
    
    Expected: equal to -652
    Actual: 978
    

    i do not think that it should be even possible to get negative lengths from intervals