Laser Robot Safe Path
Imagine a board of size numRows x numColumns with lasers placed on it. Each laser is placed at coordinates [row, column] and destroys every cell in the same row and every cell in the same column.
A robot starts at coordinates (curRow, curColumn). The robot can move in a straight line in exactly one direction: left, right, up, or down. The initial cell is protected and is not destroyed by lasers.
Return the maximum number of cells the robot can safely move through in any one direction before it would enter a destroyed cell or leave the board.
1Example 1
The lasers destroy rows 1 and 2, and columns 6 and 8. From (5, 3), the longest safe straight path is downward through three cells.
Constraints
Limits and guarantees your solution can rely on.
8 <= numRows <= 208 <= numColumns <= 201 <= curRow <= numRows1 <= curColumn <= numColumns0 <= laserCoordinates.length <= 5laserCoordinates[i].length = 21 <= laserCoordinates[i][0] <= numRows1 <= laserCoordinates[i][1] <= numColumns- The robot starts at a different cell from all laser centers.