Tap here to switch tabs
Problem
Submissions

Problem: Minimum Moves to Capture The Queen

med
30 min
Try to solve the Minimum Moves to Capture The Queen problem.

Statement

There is an 8imes88 imes 8 chessboard containing three pieces:

  • A white rook at coordinates (a, b)

  • A white bishop at coordinates (c, d)

  • A black queen at coordinates (e, f)

In each move, you may move either the white rook or the white bishop according to standard chess rules:

  • The rook can move any number of squares horizontally or vertically, but cannot jump over any piece.

  • The bishop can move any number of squares diagonally, but cannot jump over any piece.

  • The black queen does not move.

Return the minimum number of moves required for either the white rook or the white bishop to capture the black queen.

Constraints:

  • 1≤1 \leq a, b, c, d, e, f ≤8\leq 8

  • No two pieces are on the same square.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Moves to Capture The Queen

med
30 min
Try to solve the Minimum Moves to Capture The Queen problem.

Statement

There is an 8imes88 imes 8 chessboard containing three pieces:

  • A white rook at coordinates (a, b)

  • A white bishop at coordinates (c, d)

  • A black queen at coordinates (e, f)

In each move, you may move either the white rook or the white bishop according to standard chess rules:

  • The rook can move any number of squares horizontally or vertically, but cannot jump over any piece.

  • The bishop can move any number of squares diagonally, but cannot jump over any piece.

  • The black queen does not move.

Return the minimum number of moves required for either the white rook or the white bishop to capture the black queen.

Constraints:

  • 1≤1 \leq a, b, c, d, e, f ≤8\leq 8

  • No two pieces are on the same square.