Practice Minimum Moves to Capture The Queen
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
On an 8 by 8 chessboard indexed 1 through 8, a white rook is at (a, b), a white bishop at (c, d) and a stationary black queen at (e, f). A rook moves any number of cells in a row or column; a bishop moves diagonally. Neither may jump over another piece. Move only the white pieces and return the fewest moves needed to land one on the queen's cell.
Source: Minimum Moves to Capture The Queen on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
a = 1, b = 1, c = 8, d = 8, e = 2, f = 3
2
# Example 2
a = 5, b = 3, c = 3, d = 4, e = 5, f = 2
1
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Moves to Capture The Queen.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.