private int findMinimumValueAndReachCorner(int m, int n) {

//        count++;
        if(table[m][n]!=-1)
            return table[m][n];
        if (m == rows - 1 && n == columns - 1) {
            return table[m][n]=num[m][n];
        }
        if (m == rows - 1) {
            return table[m][n]=num[m][n] + findMinimumValueAndReachCorner(m, n + 1);
        }
        if (n == columns - 1) {
            return table[m][n]=num[m][n] + findMinimumValueAndReachCorner(m + 1, n);
        }
        return table[m][n]=num[m][n] + min(findMinimumValueAndReachCorner(m, n + 1), findMinimumValueAndReachCorner(m + 1, n));
    }