Hello to all . I solve one problem and cannot solve it. Help is needed. So:
There is a two-dimensional array. It is necessary to find the shortest path from (0,0) To the right lower end for example (4,4). The path through [1,1] [2,2] and so on is forbidden. The diagonal path is forbidden. At the end I should output the shortest path. In our case, it will print "10." Stop putting down cons. 
Developments:
public class moed2AQuation12015 {
public static void main (String args[]){ int mat [][] = {{ 3,13,15,28,30}, { 40,51,52,29,30}, { 28,10,53,54,53}, { 53,12,55,53,60}, { 70,62,56,20,80}, { 80,81,90,95,100}}; System.out.println(" " + shortestPath(mat)); } public static int shortestPath (int [][] mat){ return shortestPath (mat,0,0,0,0,1); } public static int shortestPath (int [][] mat,int x,int y,int x1, int y1,int count){ x1 = mat.length -1; y1 = mat[0].length -1; if (x > x1 || y > y1) return 0; if ( x == mat.length && y == mat[0].length ) return 1; System.out.println(" -> " + mat[x][y] + " --> " + count); count = shortestPath(mat,x+1,y,x1,y1,count +1) + shortestPath(mat,x,y+1,x1,y1,count +1); return 0; } }