Ad
  • Default User Avatar

    I'm able to pass the sample cases, but the cases tested when I click "attempt" don't pass.

    I try ending the string with the null character '\0', but when indexed at +1, it always prints one character extra.
    without the +1, it says the test cases failed.

    Before I ended with the null character it just attached an arbitrary number of characters after the original string, but that I did sort out

  • Default User Avatar

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

  • Default User Avatar

    code passed 117 tests but failed 1

  • Custom User Avatar

    __int128 is not standard, but apparently C translator decided to use it to get wider range of possible values.

  • Default User Avatar

    thanks a lot!! I just didn't think of "__int128" as a datatype....just found out about it.

  • Custom User Avatar

    I am trying to ask why do you use unsigned long long int, especially while solution setup quite clearly (I think) hints you that it won't be enough, and wider data type is needed.

  • Default User Avatar

    I didn't understand what you meant. could you please explain ?

  • Custom User Avatar

    Solution setup uses __int128, it might be worth to stick to it.

  • Default User Avatar

    passed 11 out of 12 tests. expects a HUGE value to be returned for a test that failed, I don't think unsigned long long int can store anything that big.

  • Default User Avatar

    wouldn't it be enough to use abs() instead of fabs() ?