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.
Can we add some more test cases for Java to stop some of the solutions that have gone through as correct but don't meet the description?
Some examples:
assertTrue(StringMerger.isMerge("abac", "ab", "ac"));
assertTrue(StringMerger.isMerge("abac", "ac", "ab"));
assertFalse(StringMerger.isMerge("abcad", "acd", "ab"));
assertFalse(StringMerger.isMerge("abcad", "ab", "acd"));
assertFalse(StringMerger.isMerge("abc", "ac", "a"));
Can we add a test case to stop this incorrectly being marked as correct?
You should assume that the compiler will execute your commands as you give them. Even if you wanted the compiler to handle that, it has no way to recognise that the first multiplication on the second line is the inverse of the function call on the first, especially when you've got a cast in between the two statements.
The extra work done on the second line also makes it hard to read.
This needs a unit test that has a 0 in it, my code choked on that the first time because I got a number with a 0 in the random test.
This needs a unit test to ensure that the code doesn't give a false positive when the double in the second number isn't of the same digit as the triple in the first number. For example, 1112345 122345 should return 0.
When I first tried this I came up with a solution that would return 0 for the numbers 11123455567890 and 12345567890, but succeeded for the tests given. Could this be added as a unit test?