Created
September 16, 2014 15:41
-
-
Save bitcpf/3d46b096b96d6838f361 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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