Ad
  • Custom User Avatar

    A plus sign before (possibly negative) rand.nextInt() doesn't make it positive. At least not in Java.

  • Custom User Avatar
  • Custom User Avatar

    Input: ORD, K^G, Q^E, DAD, T^B, A^L, B<F, S^I, AKA, AIA, JMJ, PFG, MGM

    Output:BEAHJFOKLTS

    It's not even of length 20.

  • Custom User Avatar

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

  • Custom User Avatar

    Hi. Unfortunately, your solution is incomplete. Consider this input:

    {88, 90, 89, 87}.

    Your program cannot find a solution, while it exists, e.g.:

    {88, 78, 77, 76, 86, 96, 95, 94, 93, 92, 91, 90, 80, 81, 82, 83, 84, 85, 75, 65, 66, 67, 68, 69, 79, 89, 99, 98, 97, 87}.

    Moreover, on this input:

    {88, 91, 89, 83}

    it returns a path of length 34:

    {88, 87, 86, 85, 84, 74, 73, 72, 71, 81, 91, 90, 80, 70, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 79, 89, 99, 98, 97, 96, 95, 94, 93, 83},

    while there is a path of length 32:

    {88, 78, 77, 76, 75, 74, 73, 72, 82, 92, 91, 81, 71, 61, 62, 63, 64, 65, 66, 67, 68, 69, 79, 89, 99, 98, 97, 87, 86, 85, 84, 83}.

  • Custom User Avatar

    Hi. Unfortunately, your solution is incomplete. Consider this input:

    {30, 1, 28, 0}.

    Your program cannot find a solution, while it exists, e.g.:

    {30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 29, 19, 9, 8, 7, 6, 5, 4, 3, 2, 1, 11, 12, 13, 14, 15, 16, 17, 18, 28, 27, 26, 25, 24, 23, 22, 21, 20, 10, 0}.

    Moreover, on this input:

    {56, 30, 21, 41}

    it returns a path of length 15:

    {56, 55, 54, 53, 52, 51, 50, 40, 30, 31, 21, 22, 32, 42, 41},

    while there is a path of length 13:

    {56, 55, 54, 53, 52, 51, 50, 40, 30, 20, 21, 31, 41}.

  • Custom User Avatar

    Hi. Unfortunately, your solution is incomplete. Consider this input:

    {88, 29, 98, 58}.

    Your program cannot find a solution, while it exists, e.g.:

    {88, 78, 68, 67, 57, 47, 48, 49, 39, 29, 28, 38, 37, 36, 46, 56, 66, 76, 77, 87, 97, 98, 99, 89, 79, 69, 59, 58}.

    Moreover, on this input:

    {4, 19, 21, 6}

    it returns a path of length 39:

    {4, 3, 13, 12, 11, 10, 20, 30, 40, 41, 42, 43, 44, 45, 46, 36, 37, 27, 28, 29, 19, 18, 17, 16, 26, 25, 35, 34, 33, 32, 31, 21, 22, 23, 24, 14, 15, 5, 6},

    while there is a path of length 35:

    {4, 3, 2, 1, 0, 10, 20, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 29, 19, 18, 28, 27, 26, 25, 24, 23, 22, 21, 11, 12, 13, 14, 15, 5, 6}.

  • Custom User Avatar

    Hi. Unfortunately, your solution is incomplete. Consider this input:

    {0, 2, 13, 1}.

    Your program cannot find a solution, while it exists, e.g.:

    {0, 10, 20, 30, 31, 32, 33, 34, 24, 14, 4, 3, 2, 12, 13, 23, 22, 21, 11, 1}.

    Moreover, on this input:

    {53, 49, 38, 69}

    it returns a path of length 26:

    {53, 43, 44, 45, 46, 47, 48, 49, 39, 38, 37, 36, 35, 34, 33, 32, 42, 52, 62, 63, 64, 65, 66, 67, 68, 69},

    while there is a path of length 20:

    {53, 43, 33, 23, 24, 25, 26, 27, 28, 29, 39, 49, 48, 38, 37, 47, 57, 67, 68, 69}.

  • Custom User Avatar

    A small correction. The label advSearch should be placed before the line

    for (int[] segmentOrder : SEGMENT_ORDERS) {
    

    This would give an additional 15-20% performance boost.

  • Custom User Avatar

    The copy and slide instructions are an extension implemented in Whitespace 0.3 and are designed to facilitate the implementation of recursive functions. The idea is that local variables are referred to using [Space][Tab][Space], then on return, you can push the return value onto the top of the stack and use [Space][Tab][LF] to discard the local variables.

  • Custom User Avatar

    Do you really want the cmp instruction to compare two integer constants in one of its forms? Which of the known assemblers has such a form? It doesn't make sense.

  • Custom User Avatar

    test_HandicapStones_FailPlacingTwiceInRow in Java demands an IllegalArgumentException be thrown. I think that this kind of exception is inappropriate for this case because value of the argument is irrelevant here. It would be better to throw something like IllegalStateException.

    The same is true for the test_HandicapStones_FailIfNotAtTheBeginning test.

    Regarding test_HandicapStones_FailBoardSize, it would be better to throw an UnsupportedOperationException.

    The only case when handicapStones should throw an IllegalArgumentException would be the case when the number of stones passed is indeed invalid (e.g. zero, negative or too large).

  • Custom User Avatar

    Why unclear? The next value after Z is [ because it is the next symbol in ASCII table (as well as in Unicode table). There is no mention in kata that only capital Latin letters are valid.

  • Custom User Avatar
  • Custom User Avatar

    @Blind4Basics :
    Java test cases contain an error. Please pay attention to these two lines at buildPointsField():

    Set<int[]> memo      = new HashSet<int[]>();
    ...
    if (memo.contains(pos)) continue;
    

    Arrays in Java doesn't override hashCode() and equals(). Due to this, random tests sometimes generate repeating points, which contradicts the kata description.

  • Loading more items...