Ad
  • Custom User Avatar

    .

  • Custom User Avatar

    The description says:

    ... or ... or ... or [] for Kotlin...  or ...
    
  • Custom User Avatar

    Tell me please, does Kotlin support integer arithmetic? If it does, then you would have no problem with rounding if... you do no rounding. Every test case is (should be) solved solely with integers, and problems with rounding and floating point precision are caused by the fact that you decided to use doubles (or floats). Use ints, do no rounding, use integer division, and you won't have problems.

    If Kotlin tests are constructed correctly, that is.

  • Custom User Avatar

    Just in case you're all stuck where I was, try Float instead of Double for the calculations.

    That was what finally solved it for me (Kotlin)

    A suggestion though: Rounding is something that can affect a lot depending on where you round and how many decimal places you use, etc.
    Maybe consider using test cases way less affected by this since if someone is already getting the right answer in other tests then most likely the algorithm is correct.

    PS: There is also the case of the test failing and then not failing randomly on every attempt.

  • Custom User Avatar

    Same is happening in Kotlin, the instructions mention "-1 -1 -1" but the expected array lenght is 0.

  • Custom User Avatar

    You're both right, it is not an issue. I didn't notice my comment was flagged as such, it was my first one, I'll be more careful in the future.

    I just wanted to comment that some solutions were available in 1.4 and had to update my code so it was 1.3 compatible. I'd unflag it as an issue but I'm no longer able to edit it.

    Thank you for taking the time to answer and for redirecting me to the proper place where I can post it.

  • Custom User Avatar

    Not a kata issue. If you want ask for 1.4 at: https://github.com/Codewars/codewars.com/issues.

  • Custom User Avatar

    I wouldn't say this is a kata issue, because Kotlin 1.4 isn't available right now in Codewars, it's not the same as it being available and the kata not being updated.

  • Custom User Avatar

    We should be able to use version 1.4.
    Had most of my solutions thrown out because it didn't recognize certain functions.

    Edit: I copied over the code of the 1.4 function I was using and solved it.