Advanture to Count Max Moves
tomtom's note: Feel free to check out source image for the original problem statement :)
Imagine a vast grid-like board, stretching across numRows by numColumns, where a little robot begins its journey. This robot, however, isn’t alone on the board—there are dangerous lasers positioned at specific coordinates, marked by the array laserCoordinates. Each laser is like a sentinel, protecting its row and column by destroying anything that dares to cross its path.
Our brave robot starts its adventure at a particular spot on the board, given by the coordinates (curRow, curColumn). It’s protected from the laser beams in its starting position, but the moment it moves, it’s in danger. The robot can only move in straight lines—either left, right, up, or down—but it must be cautious. The robot’s goal is to explore the board and count the maximum number of cells it can safely move through before any of the laser beams find and destroy it.
1Example 1
Constraints
Limits and guarantees your solution can rely on.
🌷