For this Question: You have a grid of n rows and m columns (n x m grid). Ketani wants to reach cell (n, m) from cell (1, 1). There are some blocked cells in the path. Ketani cannot move over a blocked cell in her path between (1, 1) to (n, m). Moreover, she can move only right and down. 
Tono knows that there is danger in the cell (n, m). So, she wants to find the minimum number of cells she needs to block so that Ketani can never reach cell (n, m).  She cannot block cells (1, 1) and (n, m).
Since Tono is small, can you help her with this problem?The first line of the input contains 2 integers n and m.
Next n lines contain m characters. Character '.' represents that the cell is not blocked while character '#' represents that the cell is blocked.
It's guaranteed, that cells (1,1) and (n,m) are empty.

Constraints
3 <= n*m <= 1000000Output a single integer, the minimum number of cells Tono needs to block.Sample Input 1
4 4
....
#.#.
....
.#..

Sample Output 1
1

Explanation: Tono can just block the cell (1, 2).

Sample Input 2
3 4
....
.##.
....

Sample Output 2
2, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    static int endr, endc;
    static char myArr[][];
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        endr = n-1;
        endc = m-1;

        char arr[][] = new char[n][m];
        for(int i=0; i<n; i++) {
            String s = sc.next();
            for(int j=0; j<m; j++)
                arr[i][j] = s.charAt(j);
        }

        myArr = arr;
        solve();



        int st = 0, en = 0;

        st += check(myArr, 0, 1);
        st += check(myArr, 1, 0);

        en += check(myArr, endr, endc-1);
        en += check(myArr, endr-1, endc);

        System.out.println(Math.min(st, en));
    }

    public static void solve() {
        for (int i=1; i<=endr; i++) {
            for(int j=1; j<=endc; j++) {
                if (myArr[i-1][j] == '#' && myArr[i][j-1] == '#')
                    myArr[i][j] = '#';
            }
        }
    }

    public static int check (char arr[][], int r, int c) {

        if (r >= 0 && r <= endr && c >= 0 && c <= endc && arr[r][c] == '.')
            return 1;

        return 0;
    }

    public static void print(char arr[][], int n, int m) {
        for(int i=0; i<n; i++) {
            for(int j=0; j<m; j++)
                System.out.print(arr[i][j]+" ");

            System.out.println();
        }
    }
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?