You are given a 2D grid where '.' represents an open cell and '#' represents a wall. A hidden robot is standing on one open cell.
The robot's sensor returns four integers: up, down, left, and right.
-
up
: how many open cells the robot can move upward before hitting a wall or leaving the grid
-
down
: how many open cells the robot can move downward before hitting a wall or leaving the grid
-
left
: how many open cells the robot can move left before hitting a wall or leaving the grid
-
right
: how many open cells the robot can move right before hitting a wall or leaving the grid
Write a function to return all open cells (row, col) that could be the robot's position given the grid and the four sensor values. Use zero-based indexing.
A candidate cell is valid only if the visible open-cell counts in all four directions exactly match the given sensor readings.