prev_dp
and curr_dp
with zeros.prev_dp[row][column]
to 1, representing the starting position of the knight.k
, do the following:
(i, j)
on the chessboard:
curr_dp[i][j]
to 0.(prev_i, prev_j)
.(prev_i, prev_j)
is within the board, add prev_dp[prev_i][prev_j] / 8
to curr_dp[i][j]
.prev_dp
and curr_dp
.prev_dp
to get the total probability.