Ad
  • Default User Avatar

    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"));

  • Default User Avatar

    Can we add a test case to stop this incorrectly being marked as correct?

  • Default User Avatar

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    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?