4034. Minimum Bishop Moves to Reach Target
There is an
8 x 8empty chessboard with 1-indexed rows and columns.You are given an array
source = [sr, sc]representing the starting position of a bishop, and an arraytarget = [tr, tc]representing the target position.In one move, the bishop travels one or more squares along a single diagonal direction, staying within the board.
Return the minimum number of moves for the bishop to land exactly on
target. If it can never reachtarget, return -1.
1 | class Solution { |