Dynamic Programming21 sections · 916 units
Open in Course

LeetCode 688 Knight Probability in Chessboard - Problem Statement

LeetCode 688

A knight starts at position (row,col)(row, col) on an n×nn \times n chessboard. It makes exactly kk moves, where each move is chosen uniformly at random from the 8 possible knight moves. The knight might move off the board.

Once off, it stays off. What's the probability that the knight remains on the board after all kk moves? Before reading on, think: what should dp track? What's the base case? How do transitions work?