Ad
  • 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.

  • 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.