You are viewing a single comment's thread. Return to all comments →
whats wrong with my iterative approach can anyone point out?
int n = game.length; int pointer = 0; while(pointer<=n){ if(pointer+leap>=n || pointer+1>=n) return true; if(pointer+leap<n && game[pointer+leap]==0){ pointer+=leap; } else if(pointer+1<n && game[pointer+1]==0){ pointer+=1; } else if(pointer-1>=0 && game[pointer-1]==0){ pointer-=1; } else{ return false; } game[pointer]=1; } return true;
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 →
whats wrong with my iterative approach can anyone point out?