public int countPaths(int n,int m){
        int T[][] = new int[n][m];
        for(int i=0; i < n; i++){
            T[i][0] = 1;
        }
        
        for(int i=0; i < m; i++){
            T[0][i] = 1;
        }
        for(int i=1; i < n; i++){
            for(int j=1; j < m; j++){
                T[i][j] = T[i-1][j] + T[i][j-1];
            }
        }
        return T[n-1][m-1];
    }
http://www.geeksforgeeks.org/count-possible-paths-top-left-bottom-right-nxm-matrix/
src/com/interview/dynamic/NumberOfPathsInMxNMatrix.java