Ad
  • Custom User Avatar

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

  • Custom User Avatar

    at first I added test from description:
    @Test
    public void testFirst() {
    int[][] firstPyramid = new int[][]{
    {3},
    {7,4},
    {2,4,6},
    {8,5,9,3}
    };
    assertEquals(23, LongestSlideDown.longestSlideDown(firstPyramid));
    }

  • Custom User Avatar

    pls add more various test arrays and detailed description, for better representation of what we are making the solution. Because I've created algoritm more flexible that it means, because after passing the test, saw failure when press "atempt", that was in logs (unfortunatelly can't upload image):

    [ 3, 7, 4, 9 ],
    [ 75, 64, 82, 87, 82, 75, 73, 28, 83, 32, 91, 78, 58, 73, 93 ],
    [ 59, 73, 52, 53, 87, 57, 92, 81, 81, 79, 81, 32, 86, 82, 97, 55, 97, 36, 62, 65, 90, 93, 95, 54, 71, 77, 68, 71, 94, 8, 89, 69, 73, 52, 39, 90, 84, 52, 95, 65, 94, 64, 96, 22, 58, 45, 56, 82, 74, 52, 98, 38, 91, 78, 90, 70, 61, 17, 65, 87, 90, 23, 54, 89, 97, 41, 64, 41, 69, 84, 67, 25, 61, 90, 75, 46, 96, 76, 77, 56, 86, 69, 90, 84, 76, 27, 78, 19, 45, 88, 48, 83, 76, 6, 87, 53, 99, 64, 77, 63 ]

    and it is very confusing, because now I understood it that we can have 4 possible entry points of pyramid, and pyramid could be more unusual that it was expected.
    I mean expected was [1] [2,3] [4, 5, 6] ...
    unusual [1, 2] [3, 4, 5, 6, 7, 8, 9][10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ...] ...
    I mean that formula for next row from the top not always n+1.

    Thank you in advance !

    P.S. btw good kata !

  • Custom User Avatar

    unfortunately, can't see the image

  • Custom User Avatar
  • Custom User Avatar

    Green is the correct path, red is your path:

  • Custom User Avatar

    The description and task are correct.

  • Custom User Avatar

    or its wrong description of the task or its wrong testcase.

    currently as it mentioned in the task from the top to bottom, result should be 1064