Free written solution

Knight Probability in Chessboard (LeetCode 688): Solution and Explanation

A knight starts on a square of an n x n board and makes k random moves, choosing each of its 8 jumps with equal chance. Once it jumps off the board it is gone. Return the probability it is still on the board after k moves.

Read the intuition, approach, code and complexity →