Java 1D Array (Part 2)

  • + 2 comments

    Hi. At each spot in the array, we have 3 options. The code tries all 3 paths for each spot in the array. If any of them lead to a solution, we return true, otherwise, false.

    isSolvable(array, m, i + m)
    

    tries to take m steps right.

    isSolvable(array, m, i + 1)
    

    tries to take 1 step right.

    isSolvable(array, m, i - 1)
    

    tries to take 1 step left.

    HackerRank solutions.