Skip to content

Instantly share code, notes, and snippets.

@bitcpf
Created September 16, 2014 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitcpf/3d46b096b96d6838f361 to your computer and use it in GitHub Desktop.
Save bitcpf/3d46b096b96d6838f361 to your computer and use it in GitHub Desktop.
public class Q9_2 {
public static int FindPath(int[] dst){
int x = dst[0];
int y = dst[1];
if(x==0 && y==0){
return 0;
}
else if(x == 0){
return 1;
}
else if(y == 0){
return 1;
}
else{
return FindPath(new int[]{x-1,y})+FindPath(new int[]{x,y-1});
}
}
public static void main(String[] argv){
int[] dst = new int[] {4,5};
System.out.println(FindPath(dst));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment