Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I can't change the tests anymore since more than 500 CW passed the kata.
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.
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.
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.
This causes an error if v1 == v2
Can you provide one clever example of how the task at hand or its solution would change if a different system were used?
Thank you -- that was exactly the problem.
Are you modifying the input? You shouldn't do that.
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
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)
This comment is hidden because it contains spoiler information about the solution
I suggest adding the hint "0! == 1" to the example in the description since it's an exception to the rule/formula shown within.
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.
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.