Ad
  • Custom User Avatar

    I have to disagree recursion is unecessary and clunky. What should be done is repeating a block of code n times, this is achieved by a loop of any kind not recursion. If you unroll above code you have alot of redundancy (null check and creating StringBuilder) and absolutely no benefit.

    Using substring that often is very expensive.

  • Custom User Avatar

    With v1=820, v2=850, and g=550
    I get mins 19,99999999999993, so I return 19 (not rounded) and it happens to expect 20.

    The correct number of minutes in this case is exactly 20, not less; no problem with the tests here.

  • Custom User Avatar

    Was this problem solved?
    I'm trying to solve this kata in python, but I ended with the same problem.

  • Custom User Avatar

    I was ending up with something like:
    [1, 20, 35] vs [1,19,35] for some...
    but then
    [0, 15, 25] vs [0, 16, 35] for others.

    So maybe there's another solution, but it seems odd that you cannot consistently round to whole numbers.

  • Custom User Avatar

    There are no rounding. Read the descriptions carefully :)

  • Custom User Avatar

    Javascript does not pass due to inconsistent rounding in answers.

  • Custom User Avatar

    With v1=80, v2=91 and g=37
    I get mins: 21,818181818181827, so I round to 22.
    Test fails because 21 is expected.

    Fair enough, I remove rounding and then...
    With v1=820, v2=850, and g=550
    I get mins 19,99999999999993, so I return 19 (not rounded) and it happens to expect 20.
    I also think the expected test results are not quite correct; can anybody also confirm?
    Thanks!

    Jaime

  • Custom User Avatar

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

  • Custom User Avatar

    This coder understood the mechanism behind the encryption / decryption; recursion makes it very elegant.