#35 - Possible moves for Horse in chess

You are given the current position of a horse (knight) on a chessboard represented by a row, col where row is the row index (0-indexed) and col is the column index (0-indexed).

There is no other piece placed in chess board.

The horse can move in an L-shape: two squares horizontally and one square vertically, or two squares vertically and one square horizontally. The moves are not blocked by other pieces on the chessboard.

Your task is to implement a function to determine all possible moves the horse can make.

Example 1

Input

row = 1
col = 2

Output

[(0, 0), (0, 4), (2, 0), (2, 4), (3, 1), (3, 3)]

Last updated