public static void dfsMatrix(int btx, int bty, int edx, int edy, int[][] obstacleGrid) {
        if (btx == edx && bty == edy) {
            res += 1;
        } else {
            // go right
            int rx = btx;
            int ry = bty + 1;

            if (!checkOverBoundary(rx, ry, edx, edy) && obstacleGrid[rx][ry] == 0) {
                dfsMatrix(rx, ry, edx, edy, obstacleGrid);
            }

            // go down
            int dx = btx + 1;
            int dy = bty;

            if (!checkOverBoundary(dx, dy, edx, edy) && obstacleGrid[dx][dy] == 0) {
                dfsMatrix(dx, dy, edx, edy, obstacleGrid);
            }
        }
    }