Official algorithmic problem description and constraints.
There is a grid, consisting of 2 rows and π columns. The rows are numbered from 1
1 to 2 from top to bottom. The columns are numbered from 1 to π from left to right. Each cell of the grid contains an arrow pointing either to the left or to the right. No arrow points outside the grid.
There is a robot that starts in a cell (1,1). Every second, the following two actions happen one after another:
Your task is to determine whether the robot can reach the cell (2,π).
Detailed video explanations, mathematical intuition, and clean C++ implementation code.