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

    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

    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

    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
  • Custom User Avatar

    Now i understand what you meant with "all faces identical", then the answer is no, i'm sorry for occupying your time.
    How do i delete this thread?

  • Custom User Avatar

    I don´t know what you mean with all faces identical, sorry, english is not my first language.
    but i can explain what my code does, first of all, my code doesn't meet all conditions to work always, but
    this array met the conditions so thats why i explain at first why should be 3, my code goes like:
    first i iterate the int[] so (1)"if (int[i]+int[i+1]==7)",if meet the conditions there goes another iteration
    that will change place with another number of the dice that will not meet the last condition (1),
    Then will return a IntStream from 0 to int[].lenght-1 that will compare int[i] to a int[i+1] and sum 2 if are opposite,
    0 if are equals or 1 if is not the last two.
    Like i said, this code isn't infallible, but for this case should be good.

  • Custom User Avatar

    I had a problem in Java small random test.
    They give me {6, 5, 2, 1} expected 4, the minimum rotation is 3, because i can change 2 and 1 in positions
    and that would give me {6, 5, 1, 2} then applying rotations: 6 to 5 = 1, 5 to 1 = 1 and 1 to 2 = 1,
    giving 3 rotations in total.