Ad
  • Custom User Avatar

    Pretty cool, but incredibly slow.

  • Custom User Avatar

    yes, crap :)

  • Custom User Avatar

    If str_in is empty string then out[2*strlen(str_in)-1] is unallocated memory

  • Custom User Avatar

    Hmm I don't get it.. It says all Java testcases passed green and then below it says it timed out after 16s, however the sum of each test duration is roughly 5s, nowhere near 16s. Is it still just my solution that is slow or something else?

    Test Results:
    SolutionTest
    basicTests
    Test Passed
    Completed in 1ms
    RandomTests_shortArrays
    Test Passed
    Completed in 1508ms
    BiggerFixedTests
    Test Passed
    Completed in 3211ms
    RandomTests_biggernums
    Test Passed
    Completed in 450ms
    fixedTests_larger_arrays
    Test Passed
    Completed in 2ms
    STDERR
    Execution Timed Out (16000 ms)

  • Custom User Avatar

    In the "Really close to target" test case I think the arrow hits inside r2 but outside r1, which is weird since r2 is supposed to be smaller than r1 (r1=1.0 r2=4.0). The reference seems to just give 0 points if it hits outside r1, even if it is inside r2.. But I suppose the test should be changed so that r2 < r1. Nice kata by the way!

  • Custom User Avatar

    you are completely correct! many thanks for pointing this out. I have done some, uh, heavy refactoring, including adding your critical example to the test suite. ;)

  • Custom User Avatar

    Yes have you tried that (made up) test with the above code? I think it will output {1, 2, 4} instead. In the solution function local[0] == local[1]. Then minab = local[0] + 1 != local[1], which breaks the loop and output]1] will be wrong...

    int minab = local[0] + 1;
    output[2] = local[n - 1];
    for(size_t i=1; i<n; i++) {
        if(minab == local[i]) minab++;
        else break;
    }
    output[1] = minab;
    

    I had a bit random problems with this when doing the kata : )

  • Custom User Avatar

    that's a correct test. [0] (min) = 1, [1] (next smaller number not in the array) = 3, [2] (max) = 4

  • Custom User Avatar

    If there is another number after the duplicate, e.g:

    {
    const int test_arr[4] = {1, 1, 2, 4};
    const int expected[3] = {1, 3, 4};
    tester(test_arr, 4, expected);
    }

  • Custom User Avatar

    I'm not sure I follow you. The "solution" function does not assume unique numbers. It is designed to handle duplicates.

  • Custom User Avatar

    I think the random tests can produce duplicates but the "solution" function assumes unique numbers to always give valid output..