Untitled
unknown
plain_text
a year ago
1.3 kB
3
Indexable
Never
import java.util.*; // public class Main { // static int countAllPathHelper(int sr, int sc, int dr, int dc, boolean[][] visited){ // if(sr<1 || sc<1 || sr>dr || sc>dc || visited[sr][sc]==true) return 0; // if(sr == dr && sc == dc){ // return 1; // } // int count =0 ; // visited[sr][sc]=true; // count += countAllPathHelper(sr, sc+1, dr, dc, visited); // count += countAllPathHelper(sr+1, sc, dr, dc, visited); // count += countAllPathHelper(sr, sc-1, dr, dc, visited); // count += countAllPathHelper(sr-1, sc, dr, dc, visited); // count += countAllPathHelper(sr+1, sc+1, dr, dc, visited); // count += countAllPathHelper(sr-1, sc-1, dr, dc, visited); // count += countAllPathHelper(sr+1, sc-1, dr, dc, visited); // count += countAllPathHelper(sr-1, sc+1, dr, dc, visited); // visited[sr][sc]=false; // return count; // } // static int countAllPath(int dr, int dc) // { // //Write your code here // boolean visited[][] = new boolean[dr+1][dc+1]; // return countAllPathHelper(1, 1, dr, dc, visited); // } // public static void main(String[] args) { // Scanner sc = new Scanner(System.in); // int n= sc.nextInt(); // int m= sc.nextInt(); // System.out.println(countAllPath(n,m)); // } // }