Tap here to switch tabs
Problem
Submissions

Problem: Minimum Queen Moves to Reach Target

Try to solve the Minimum Queen Moves to Reach Target problem.

Statement

Given two integer arrays source =[= [ sr, sc ]] and target =[= [ tr, tc ]], representing the coordinates of a queen and a destination square on an 8imes88 imes 8 chessboard.

In one move, a queen can travel any number of squares in a straight line horizontally, vertically, or diagonally.

Return the minimum number of moves required to move the queen from source to target.

Constraints:

  • source =[= [ sr, sc ]]

  • target =[= [ tr, tc ]]

  • 1≤1 \leq sr, sc, tr, tc ≤8\leq 8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Queen Moves to Reach Target

Try to solve the Minimum Queen Moves to Reach Target problem.

Statement

Given two integer arrays source =[= [ sr, sc ]] and target =[= [ tr, tc ]], representing the coordinates of a queen and a destination square on an 8imes88 imes 8 chessboard.

In one move, a queen can travel any number of squares in a straight line horizontally, vertically, or diagonally.

Return the minimum number of moves required to move the queen from source to target.

Constraints:

  • source =[= [ sr, sc ]]

  • target =[= [ tr, tc ]]

  • 1≤1 \leq sr, sc, tr, tc ≤8\leq 8