You are viewing a single comment's thread. Return to all comments →
My Solution: // Return true if you can win the game; otherwise, return false. if(index < 0 || game[index] == 1) { return false; } if(index +1 > game.length-1 || index + leap > game.length-1) { return true; } game[index] =1;
return canWin(leap, game, index-1) || canWin(leap, game, index+1)|| canWin(leap, game, index+leap); }
Seems like cookies are disabled on this browser, please enable them to open this website
Java 1D Array (Part 2)
You are viewing a single comment's thread. Return to all comments →
My Solution: // Return true if you can win the game; otherwise, return false. if(index < 0 || game[index] == 1) { return false; } if(index +1 > game.length-1 || index + leap > game.length-1) { return true; } game[index] =1;