Ad
  • Custom User Avatar
  • Custom User Avatar

    Multiple solutions are possible, so there is no one true solution to show. Showing a solution would be possible, but would give away the kata solution ( there are always ways to peek at that code ).

    Closing.

  • Custom User Avatar
  • Custom User Avatar

    Wow, thank you very much, now i understand where is the problem, i'll fix it immediately
    //Update: Fixed it.

  • Custom User Avatar

    For example, I just got a random test with age = 57 and IHR = 32.

    Here (220 - 57) * 20% = 32.6, which is greater than IHR, and the reference solution assumes that the 0.6 portion contributes to the distance as in the safe zone.

    The core problem is that in your random IHR generation, the lower bound MHR * 20% is by default rounded downwards. If you round it upwards (via Math.ceil), it should resolve the issue.

  • Custom User Avatar

    Before i removed input validations, there was a condition where, if it's below 20%MHR it would be zero, and i didn't change the final solution because i wrote test cases in a manner where always is gonna give >=20%MHR, so i find strange what you say about "Tests involve cases where IHR < MHR * 20%".

    int HR = new Random().nextInt(HRM20/100,HRM)
    //HRM
    20/100 it's the origin parameter, so it can be the minimum parameter.

    i looked the other test cases, but i think none of them are wrong, but maybe i overlooked it, if that's the case, please point me out the problem.
    //Sorry for the strange english, i can read fine, but i don't write too much

  • Custom User Avatar

    That was for "difficulty" in the beginning, but i should've removed it when i delete input validations.
    I will change it now.

  • Custom User Avatar

    Tests with negative speed? Why?

  • Custom User Avatar

    Tests involve cases where IHR < MHR * 20%. The reference solution assumes that heart rates below MHR * 20% are effectively in the "soft" zone. In other words, the reference solution assumes that the soft zone begins at zero heart rate.

  • Custom User Avatar

    I updated it, if you think there's something wrong, don't doubt to tell me.

  • Custom User Avatar

    Okay! thanks for your review, i will modify it now.

  • Custom User Avatar

    Remove input validation.

  • Custom User Avatar

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

  • Custom User Avatar

    I think it would be a great idea to inform the user about the solution when it's wrong in the sample tests, which would make the debugging part less tedious

  • Custom User Avatar
  • Loading more items...