Ad
  • Custom User Avatar

    I can't change the tests anymore since more than 500 CW passed the kata.

  • Custom User Avatar

    Well spotted.

    Change the condition in the first line to v1 >= v2 and it's ok again.

    The kata author should have provided a test case for this, but it seems they did not, and the random test cases are generated in such a way that it never happens that v2 > v1.

  • Default User Avatar

    There is no test case for v1 == v2, which is a condition that the instructions specify should result in 'nil'. Many of the accepted answers do not meet this requirement and cannot handle this input at all.

  • Default User Avatar

    The author failed to provide a test for it, but this does not correctly return nil if v1 == v2, and instead results in an error.

  • Default User Avatar

    This causes an error if v1 == v2

  • Default User Avatar

    Can you provide one clever example of how the task at hand or its solution would change if a different system were used?

  • Default User Avatar

    Thank you -- that was exactly the problem.

  • Custom User Avatar

    Are you modifying the input? You shouldn't do that.

  • Default User Avatar

    Shouldn't a combination in which every A bonds to a T and every G bonds to a C return true?

    Testing for ACATTAAGTTA and TAACTTAATGT
    It should work random inputs too - Expected: false, instead got: true

    ACATTAAGTTA
    TGTAATTCAAT

  • Default User Avatar

    Incorrect solutions are being submitted and voted up not because anyone wants to cheat but because many people didn't see the text below "An easy problem." Be more specific if you want to give constuctive criticism. (and don't wait until someone calls you out to do so)

  • Default User Avatar

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

  • Default User Avatar

    I suggest adding the hint "0! == 1" to the example in the description since it's an exception to the rule/formula shown within.

  • Default User Avatar

    It's also worth noting that this kata appears to expect an input of 0 to output 0 even though that is one zero followed by no other numbers.

  • Default User Avatar

    The creator of the kata figured that input of 0 should return 0... at least that's what I think is happening here. My code worked in tests, but failed on submission until I removed the handling of n == 0. Is a lone zero considered "trailing?" I could not find a definitive answer, so I agree that a single zero should be counted as 1.